import { DEFAULT_LANGUAGE } from "@/lib/i18n/registry";
import { getSiteSeoMeta, getSeoPage, type SeoPageKey } from "@/lib/i18n/seo";
import type { PageSeoEntry } from "./pageSeo.types";

export { SITE_URL } from "./site";

const LEGACY_PAGE_KEYS = [
  "home",
  "academy",
  "projects",
  "billboards",
  "explore",
  "search",
  "about",
] as const satisfies readonly SeoPageKey[];

const faSite = getSiteSeoMeta(DEFAULT_LANGUAGE);

/** @deprecated Use getSiteSeoMeta(lang).name */
export const SITE_NAME = faSite.name;

/** @deprecated Use getSiteSeoMeta(lang).keywords */
export const siteKeywords = faSite.keywords;

/** Persian-only legacy map — prefer getSeoPage(key, lang) for locale-aware SEO */
export const pageSeo = Object.fromEntries(
  LEGACY_PAGE_KEYS.map((key) => {
    const page = getSeoPage(key, DEFAULT_LANGUAGE);
    return [
      key,
      {
        title: page.title,
        description: page.description,
        path: page.path,
        keywords: page.keywords,
      } satisfies PageSeoEntry,
    ];
  })
) as Record<(typeof LEGACY_PAGE_KEYS)[number], PageSeoEntry>;

export type { PageSeoEntry };
