ActiveAdmin.setup do |config|
  config.site_title = "Teletype Games Admin"

  config.authentication_method = :authenticate_admin_user!
  config.current_user_method   = :current_admin_user
  config.logout_link_path      = :destroy_admin_user_session_path
  config.logout_link_method    = :delete

  config.comments = false
  config.batch_actions = true
  config.filter_attributes = [:password, :password_confirmation, :current_password, :encrypted_password]

  config.localize_format = :long

  config.namespace :admin do |admin|
    admin.build_menu :utility_navigation do |menu|
      menu.add id: "site_link",
               label: "🏠 Go to Site",
               url: ENV.fetch("SITE_URL", "https://teletypegames.org"),
               html_options: { target: "_blank", title: "Open site" },
               priority: 1

      menu.add id: "logout",
               label: "🚪 Logout",
               url: :destroy_admin_user_session_path,
               html_options: { method: :delete },
               priority: 99
    end
  end
end
