/**
 * JSON-LD schema builder for the Flights Map page.
 *
 * Produces a schema.org WebPage typed object ready for <JsonLdRenderer>.
 *
 * @module
 */

import type { WebPage } from "schema-dts";

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

const SITE_NAME = "Aeroflot";
const PATH_WITHOUT_LOCALE = "/flights-map";

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

/**
 * Build a schema.org WebPage JSON-LD object for the flights map page.
 */
export function buildFlightsMapJsonLd(
  locale: string,
  canonicalOrigin: string,
): WebPage {
  const url = `${canonicalOrigin}/${locale}${PATH_WITHOUT_LOCALE}`;

  return {
    "@type": "WebPage",
    name: `${SITE_NAME} - Flight Map`,
    url,
    inLanguage: locale,
    isPartOf: {
      "@type": "WebSite",
      name: SITE_NAME,
      url: canonicalOrigin,
    },
  };
}
