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

interface JsonLdProps {
  locale: Locale;
}

export function OrganizationJsonLd({ locale }: JsonLdProps) {
  const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || 'https://damjan-savic.com';

  const schema = {
    '@context': 'https://schema.org',
    '@type': 'Organization',
    '@id': `${baseUrl}/#organization`,
    name: 'Damjan Savić - AI & Automation Specialist',
    alternateName: 'Damjan Savić',
    url: baseUrl,
    logo: {
      '@type': 'ImageObject',
      url: `${baseUrl}/images/og-image.jpg`,
      width: 1200,
      height: 630,
    },
    image: `${baseUrl}/images/og-image.jpg`,
    description: locale === 'de'
      ? 'Freelance KI-Entwickler und Automatisierungsspezialist aus Köln. Spezialisiert auf KI-Agenten, Voice AI, Prozessautomatisierung mit n8n und SaaS-Entwicklung.'
      : locale === 'sr'
      ? 'Freelance AI developer i specijalista za automatizaciju iz Kelna. Specijalizovan za AI agente, Voice AI, automatizaciju procesa sa n8n i SaaS razvoj.'
      : 'Remote AI developer and automation specialist based in Germany. Working with clients in USA, UK & Europe. Specialized in AI agents, Voice AI, n8n automation and SaaS development.',
    email: 'info@damjan-savic.com',
    telephone: '+491756950979',
    address: {
      '@type': 'PostalAddress',
      streetAddress: 'Rotdornallee',
      addressLocality: locale === 'sr' ? 'Keln' : locale === 'en' ? 'Cologne' : 'Köln',
      addressRegion: 'NRW',
      postalCode: '50769',
      addressCountry: 'DE',
    },
    geo: {
      '@type': 'GeoCoordinates',
      latitude: 50.9375,
      longitude: 6.9603,
    },
    areaServed: [
      // DACH Region
      { '@type': 'Country', name: 'Germany' },
      { '@type': 'Country', name: 'Austria' },
      { '@type': 'Country', name: 'Switzerland' },
      // International (Remote)
      { '@type': 'Country', name: 'United States' },
      { '@type': 'Country', name: 'United Kingdom' },
      { '@type': 'Country', name: 'Serbia' },
      // Major International Cities
      { '@type': 'City', name: 'New York' },
      { '@type': 'City', name: 'London' },
      { '@type': 'City', name: 'San Francisco' },
      { '@type': 'City', name: 'Los Angeles' },
    ],
    founder: {
      '@id': `${baseUrl}/#person`,
    },
    sameAs: [
      'https://www.linkedin.com/in/damjansavic/',
      'https://github.com/damjansavic',
    ],
    contactPoint: {
      '@type': 'ContactPoint',
      contactType: 'customer service',
      email: 'info@damjan-savic.com',
      telephone: '+491756950979',
      availableLanguage: ['German', 'English', 'Serbian'],
    },
  };

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