# typed: strict
class Domain::PostGroup::InkbunnyPool < Domain::PostGroup
  attr_json :ib_id, :integer
  attr_json :deep_update_log_entry_id, :integer
  attr_json :count, :integer
  attr_json :name, :string
  attr_json :description, :string
  attr_json :owner_id, :integer
  validates :ib_id, presence: true

  belongs_to :deep_update_log_entry,
             class_name: "::HttpLogEntry",
             optional: true

  belongs_to :owner, class_name: "::Domain::User::InkbunnyUser", optional: true

  sig { override.returns([String, Symbol]) }
  def self.param_prefix_and_attribute
    ["ib", :ib_id]
  end

  sig { override.returns(T.nilable(String)) }
  def external_url_for_view
    if ib_id = self.ib_id
      "https://inkbunny.net/submissionsviewall.php?pool_id=#{self.ib_id}"
    end
  end
end
