# typed: strict
class Domain::PostGroup < ReduxApplicationRecord
  extend T::Helpers
  include AttrJsonRecordAliases
  include HasCompositeToParam
  self.table_name = "domain_post_groups"
  abstract!

  has_many :post_group_joins,
           class_name: "::Domain::PostGroupJoin",
           inverse_of: :group,
           dependent: :destroy
  has_many :posts, through: :post_group_joins, source: :post

  sig { overridable.returns(T.nilable(String)) }
  def external_url_for_view
    nil
  end
end

# eager load all subclasses
Dir[Rails.root.join("app/models/domain/post_group/**/*.rb")].each do |file|
  require_dependency file
end
