/**
 * SEO builder functions for Flights Map route page.
 *
 * Pure function -- all data arrives via parameters, no hooks or side effects.
 * Returns a SeoHeadProps object ready for <SeoHead>.
 *
 * @module
 */

import type { SeoHeadProps } from "@/ui/seo/SeoHead.js";
import { buildHreflangSet } from "@/shared/seo/hreflang.js";

// ---------------------------------------------------------------------------
// Types
// ---------------------------------------------------------------------------

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type TFunction = (key: string, opts?: any) => string;

// ---------------------------------------------------------------------------
// Constants
// ---------------------------------------------------------------------------

const OG_IMAGE = "https://www.aeroflot.ru/static/images/aeroflot-og-default.png";
const SITE_NAME = "Aeroflot";
const PATH_WITHOUT_LOCALE = "/flights-map";

// ---------------------------------------------------------------------------
// Public
// ---------------------------------------------------------------------------

/**
 * SEO props for the Flights Map start page.
 */
export function buildFlightsMapSeo(
  t: TFunction,
  locale: string,
  canonicalOrigin: string,
): SeoHeadProps {
  const title = t("SEO.FLIGHTS-MAP.MAIN.TITLE");
  const description = t("SEO.FLIGHTS-MAP.MAIN.DESCRIPTION");
  const canonical = `${canonicalOrigin}/${locale}${PATH_WITHOUT_LOCALE}`;

  return {
    title,
    description,
    canonical,
    hreflang: buildHreflangSet({
      canonicalOrigin,
      pathWithoutLocale: PATH_WITHOUT_LOCALE,
    }),
    og: {
      title,
      description,
      url: canonical,
      image: OG_IMAGE,
      type: "website",
      locale,
      siteName: SITE_NAME,
    },
    twitter: {
      card: "summary",
    },
  };
}
