import { COMPANY, PARTNERS, SITE_URL } from "@/content/site";
import type { Dictionary, Locale } from "@/lib/i18n";

/** Schema.org structured data — only facts stated in the company profile. */
export function organizationJsonLd(locale: Locale, t: Dictionary) {
  return {
    "@context": "https://schema.org",
    "@graph": [
      {
        "@type": "Organization",
        "@id": `${SITE_URL}/#organization`,
        name: COMPANY.name,
        legalName: COMPANY.legalName,
        url: `${SITE_URL}/${locale}`,
        logo: `${SITE_URL}/icon-512.png`,
        image: `${SITE_URL}/og-image.jpg`,
        slogan: COMPANY.tagline,
        description: t.meta.description,
        founder: { "@type": "Person", name: COMPANY.founder },
        areaServed: { "@type": "Country", name: "Indonesia" },
        knowsAbout: t.expertise.items.map((i) => i.title),
        memberOf: PARTNERS.memberOf.map((m) => ({ "@type": "Organization", name: m.name })),
      },
      {
        "@type": "WebSite",
        "@id": `${SITE_URL}/#website`,
        url: SITE_URL,
        name: COMPANY.name,
        inLanguage: ["en", "id"],
        publisher: { "@id": `${SITE_URL}/#organization` },
      },
      {
        "@type": "WebPage",
        "@id": `${SITE_URL}/${locale}#webpage`,
        url: `${SITE_URL}/${locale}`,
        name: t.meta.title,
        description: t.meta.description,
        inLanguage: locale,
        isPartOf: { "@id": `${SITE_URL}/#website` },
        about: { "@id": `${SITE_URL}/#organization` },
      },
    ],
  };
}
