import { routing } from "@/i18n/routing";

const port = process.env.PORT || 3000;
const host = process.env.NEXT_PUBLIC_SITE_URL
  ? process.env.NEXT_PUBLIC_SITE_URL
  : process.env.VERCEL_PROJECT_PRODUCTION_URL
    ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
    : `http://localhost:${port}`;

if (process.env.VERCEL_ENV === "production" && host.startsWith("http://localhost")) {
  throw new Error(
    "site.url resolved to localhost in production. Set NEXT_PUBLIC_SITE_URL or VERCEL_PROJECT_PRODUCTION_URL.",
  );
}

export const site = {
  // The trading name, and the ONLY name a machine should be handed: `og:site_name`,
  // `WebSite.name`, `Organization.name`, `authors`/`publisher`, the breadcrumb root and
  // the RSS channel all read it. Google derives the site name shown above a SERP result
  // from `WebSite.name`, so the wordmark used to put "ADV MFR" there, on top of titles
  // ending in "| Advance Mfrs". One name, one source (ADVMF-66).
  name: "Advance Manufacturers",
  // The company's short name — one word, no space. It is an alias, not a display
  // string: `Organization.alternateName`, `WebSite.alternateName`, the PWA
  // `short_name` and `apple-mobile-web-app-title`. Do not confuse it with `wordmark`.
  shortName: "ADVMFR",
  // The logo lockup, spelled with a space because that is how it is SET, not how the
  // company is named. Rendered only — the OG card and the logo alt. It must never
  // reach a `<meta>` tag or a JSON-LD node.
  wordmark: "ADV MFR",
  // Brand token appended to every page `<title>` (`%s | Advance Mfrs`). The SEO source
  // writes the titles that way (`pages/*/{en,fr}/index.meta.json`, `meta_title`), so the
  // rendered title has to use the same suffix the copy was written and measured against.
  // Hence its place among the `alternateName` aliases: it is a third spelling users may
  // search for, not the site name.
  titleSuffix: "Advance Mfrs",
  legalName: "Advance Manufacturers Co., Ltd.",
  // Thai company registration number (doubles as corporate tax ID since 2012).
  registrationNumber: "0105532085411",
  description:
    "Fine jewellery manufacturer in Bangkok, Thailand. OEM, ODM and custom production in gold, silver and brass since 1989.",
  url: host,
  // Charcoal `--foreground` from the design system (src/app/globals.css).
  themeColor: "#1a1c1b",
  backgroundColor: "#ffffff",
  logo: {
    src: "/logo-advance-manufacturer.svg",
    // Intrinsic size of the SVG (viewBox="0 0 435.77 373.29"), rounded to whole pixels.
    width: 436,
    height: 373,
    // The lockup, matching `wordmark` — this is the image OF the wordmark.
    alt: "ADV MFR",
  },
  // Raster counterpart of the logo, for consumers that will not rasterise an SVG —
  // Google wants a crawlable image with known dimensions on `Organization.logo`.
  logoRaster: {
    src: "/android-chrome-512x512.png",
    width: 512,
    height: 512,
  },
  social: {
    twitter: "@advmfr",
    github: "",
    linkedin: "https://www.linkedin.com/company/advancemfr",
    instagram: "https://www.instagram.com/advancemfr",
    facebook: "https://www.facebook.com/AdvanceMfr",
  },
  contact: {
    email: "advance@advmfr.com",
    // Mirrors the tel: link / `ContactUsPage.info.phone` rendered in ContactInfo.tsx.
    phone: "+66 (0) 2326-0985-7",
    fax: "+66 (0) 2739-4676",
    // Full official street address (documented company record; the contact page UI
    // shows a shorter form in `ContactUsPage.info.address`).
    streetAddress:
      "366 Moo 4, Chalongkrung Road, Export Processing Zone 3, Lat Kra Bang Industrial Estate, Lam Pla Thio, Lat Krabang",
    addressLocality: "Bangkok",
    postalCode: "10520",
    addressCountry: "TH",
    // Bangkok factory geo — coordonnées exactes fournies par le client.
    // Source unique : le repère de la carte dans ContactInfo.tsx en dérive.
    geo: { latitude: 13.77872523318779, longitude: 100.78801077819179 },
  },
  blog: {
    // TODO: replace with a real author avatar
    authorAvatar: "/blog/authors/placeholder.webp",
  },
  defaultLocale: routing.defaultLocale,
  locales: routing.locales,
} as const;
