import { type Locale } from '@/i18n/config';

interface JsonLdProps {
  locale: Locale;
}

// WebSite Schema for Search Box
export function WebSiteJsonLd({ locale }: JsonLdProps) {
  const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || 'https://damjan-savic.com';

  const schema = {
    '@context': 'https://schema.org',
    '@type': 'WebSite',
    '@id': `${baseUrl}/#website`,
    name: 'Damjan Savić',
    alternateName: locale === 'de'
      ? 'Damjan Savić - KI Entwickler Köln'
      : locale === 'sr'
      ? 'Damjan Savić - AI Developer Keln'
      : 'Damjan Savić - AI Developer Cologne',
    url: baseUrl,
    description: locale === 'de'
      ? 'Portfolio und Blog von Damjan Savić - KI-Entwickler und Automatisierungsspezialist aus Köln'
      : locale === 'sr'
      ? 'Portfolio i blog Damjana Savića - AI developer i specijalista za automatizaciju iz Kelna'
      : 'Portfolio and blog of Damjan Savić - AI Developer and Automation Specialist from Cologne',
    publisher: {
      '@id': `${baseUrl}/#organization`,
    },
    inLanguage: [
      { '@type': 'Language', name: 'German', alternateName: 'de' },
      { '@type': 'Language', name: 'English', alternateName: 'en' },
      { '@type': 'Language', name: 'Serbian', alternateName: 'sr' },
    ],
  };

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