# typed: strict
module Domain::RouteHelper
  extend T::Sig

  class RouteData < T::Struct
    include T::Struct::ActsAsComparable

    const :klass, T.class_of(ActiveRecord::Base)
    const :resource_name, Symbol
    const :param, Symbol
    const :subpath, String
    const :controller, String
  end

  DOMAIN_POST_RESOURCES =
    T.let(
      [
        RouteData.new(
          klass: Domain::Post::InkbunnyPost,
          resource_name: :domain_post_inkbunny_posts,
          param: :ib_id,
          subpath: "ib",
          controller: "domain/posts/inkbunny_posts",
        ),
        RouteData.new(
          klass: Domain::Post::E621Post,
          resource_name: :domain_post_e621_posts,
          param: :e621_id,
          subpath: "e621",
          controller: "domain/posts/e621_posts",
        ),
        RouteData.new(
          klass: Domain::Post::FaPost,
          resource_name: :domain_post_fa_posts,
          param: :fa_id,
          subpath: "fa",
          controller: "domain/posts/fa_posts",
        ),
      ],
      T::Array[RouteData],
    )

  DOMAIN_USER_RESOURCES =
    T.let(
      [
        RouteData.new(
          klass: Domain::User::InkbunnyUser,
          resource_name: :domain_user_inkbunny_users,
          param: :name,
          subpath: "ib",
          controller: "domain/users/inkbunny_users",
        ),
        RouteData.new(
          klass: Domain::User::E621User,
          resource_name: :domain_user_e621_users,
          param: :e621_id,
          subpath: "e621",
          controller: "domain/users/e621_users",
        ),
        RouteData.new(
          klass: Domain::User::FaUser,
          resource_name: :domain_user_fa_users,
          param: :url_name,
          subpath: "fa",
          controller: "domain/users/fa_users",
        ),
      ],
      T::Array[RouteData],
    )
end
