const BASE_URL = "https://www.elevaseo.com";

interface ServiceHubSchemaProps {
  description: string;
  locale: string;
  name: string;
  path: string;
  serviceType: string;
}

/**
 * Service JSON-LD for hub pages (e.g. /services/wordpress).
 *
 * Hubs aren't priced atomic offers, so they shouldn't reuse `ServiceSchema`
 * (which requires `service.price` from the catalog and emits `offers`).
 * This emits a richer Service block with `serviceType`, `provider`,
 * `areaServed`, and `availableLanguage` per the GSC remediation brief.
 */
export function ServiceHubSchema({
  name,
  description,
  serviceType,
  locale,
  path,
}: ServiceHubSchemaProps) {
  const prefix = locale === "fr" ? "" : `/${locale}`;
  const url = `${BASE_URL}${prefix}${path}`;

  const jsonLd = {
    "@context": "https://schema.org",
    "@type": "Service",
    name,
    description,
    serviceType,
    url,
    provider: {
      "@type": "Organization",
      name: "ElevaSEO",
      url: BASE_URL,
      areaServed: ["FR", "Europe", "North America"],
    },
    areaServed: ["FR", "Europe", "North America"],
    availableLanguage: ["fr", "en"],
  };

  return (
    <script
      dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
      type="application/ld+json"
    />
  );
}
