# typed: strict
module Domain::DomainModelHelper
  extend T::Sig
  extend T::Helpers
  include HelpersInterface
  abstract!

  HasDomainTypeType =
    T.type_alias { T.any(HasDomainType, HasDomainType::ClassMethods) }

  sig { params(model: HasDomainTypeType).returns(String) }
  def domain_name_for_model(model)
    case model.domain_type
    when Domain::DomainType::Fa
      "FurAffinity"
    when Domain::DomainType::E621
      "E621"
    when Domain::DomainType::Inkbunny
      "Inkbunny"
    when Domain::DomainType::Sofurry
      "Sofurry"
    end
  end

  sig { params(model: HasDomainTypeType).returns(String) }
  def domain_abbreviation_for_model(model)
    case model.domain_type
    when Domain::DomainType::Fa
      "FA"
    when Domain::DomainType::E621
      "E621"
    when Domain::DomainType::Inkbunny
      "IB"
    when Domain::DomainType::Sofurry
      "SF"
    end
  end

  sig { params(model: Domain::Post).returns(String) }
  def title_for_post_model(model)
    case model
    when Domain::Post::FaPost
      model.title
    when Domain::Post::E621Post
      model.title
    when Domain::Post::InkbunnyPost
      model.title
    when Domain::Post::SofurryPost
      model.title
    end || "(unknown)"
  end
end
