# typed: strict
module DomainSourceHelper
  extend T::Sig

  sig { returns(T::Hash[String, String]) }
  def self.source_name_to_class_name
    {
      "furaffinity" => "Domain::Post::FaPost",
      "e621" => "Domain::Post::E621Post",
      "inkbunny" => "Domain::Post::InkbunnyPost",
    }
  end

  sig { returns(T::Array[String]) }
  def self.all_source_names
    source_name_to_class_name.keys
  end

  sig { params(list: T::Array[String]).returns(T::Array[String]) }
  def self.source_names_to_class_names(list)
    list.map { |source| source_name_to_class_name[source] }.compact
  end

  sig { params(list: T::Array[String]).returns(T::Boolean) }
  def self.has_all_sources?(list)
    list.sort == all_source_names.sort
  end
end
