import { msg } from "@lingui/core/macro";
import { createI18n, type AppLocale } from "@/lib/i18n";

// og:locale wants a territory-qualified tag (en_US), not our bare AppLocale code.
const OG_LOCALE_BY_LOCALE: Record<AppLocale, string> = {
  en: "en_US",
  es: "es_MX",
  de: "de_DE",
  ja: "ja_JP",
};

export interface RootMeta {
  description: string;
  ogImageAlt: string;
  ogLocale: string;
}

/** Localized strings for the root route's <head> meta tags. */
export function getRootMeta(locale: AppLocale): RootMeta {
  const i18n = createI18n(locale);
  return {
    description: i18n._(msg`FLXN — beer pong tournaments, brackets, and stats.`),
    ogImageAlt: i18n._(msg`FLXN logo`),
    ogLocale: OG_LOCALE_BY_LOCALE[locale] ?? OG_LOCALE_BY_LOCALE.en,
  };
}
