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

interface JsonLdProps {
  locale: Locale;
}

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

  const serviceNames = {
    de: [
      'KI-Entwicklung',
      'Prozessautomatisierung',
      'Voice AI Entwicklung',
      'SaaS Entwicklung',
      'Fullstack Webentwicklung',
      'n8n Automatisierung',
    ],
    en: [
      'AI Development',
      'Process Automation',
      'Voice AI Development',
      'SaaS Development',
      'Fullstack Web Development',
      'n8n Automation',
    ],
    sr: [
      'AI Razvoj',
      'Automatizacija procesa',
      'Voice AI Razvoj',
      'SaaS Razvoj',
      'Fullstack Web Razvoj',
      'n8n Automatizacija',
    ],
  };

  const schema = {
    '@context': 'https://schema.org',
    '@type': 'ProfessionalService',
    '@id': `${baseUrl}/#business`,
    name: 'Damjan Savić - AI & Automation Specialist',
    description: locale === 'de'
      ? 'Freelance AI & Automation Specialist aus Köln. Spezialisiert auf KI-Agenten, Voice AI, Prozessautomatisierung und SaaS-Entwicklung.'
      : locale === 'sr'
      ? 'Freelance AI & Automation Specialist iz Kelna. Specijalizovan za AI agente, Voice AI, automatizaciju procesa i SaaS razvoj.'
      : 'Remote AI & Automation Specialist based in Germany, serving clients in USA, UK and Europe. Specialized in AI agents, Voice AI, n8n process automation and custom SaaS development.',
    url: baseUrl,
    logo: `${baseUrl}/images/og-image.jpg`,
    image: `${baseUrl}/images/og-image.jpg`,
    email: 'info@damjan-savic.com',
    telephone: '+491756950979',
    priceRange: '€€€',
    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: [
      // Germany
      { '@type': 'City', name: 'Cologne' },
      { '@type': 'City', name: 'Düsseldorf' },
      { '@type': 'City', name: 'Frankfurt' },
      { '@type': 'City', name: 'Munich' },
      { '@type': 'City', name: 'Berlin' },
      { '@type': 'City', name: 'Hamburg' },
      { '@type': 'Country', name: 'Germany' },
      // USA
      { '@type': 'City', name: 'New York' },
      { '@type': 'City', name: 'Los Angeles' },
      { '@type': 'City', name: 'San Francisco' },
      { '@type': 'City', name: 'Miami' },
      { '@type': 'City', name: 'Chicago' },
      { '@type': 'Country', name: 'United States' },
      // UK
      { '@type': 'City', name: 'London' },
      { '@type': 'Country', name: 'United Kingdom' },
      // Europe
      { '@type': 'Country', name: 'Austria' },
      { '@type': 'Country', name: 'Switzerland' },
    ],
    hasOfferCatalog: {
      '@type': 'OfferCatalog',
      name: locale === 'de' ? 'Dienstleistungen' : locale === 'sr' ? 'Usluge' : 'Services',
      itemListElement: serviceNames[locale].map((service, index) => ({
        '@type': 'Offer',
        itemOffered: {
          '@type': 'Service',
          name: service,
        },
        position: index + 1,
      })),
    },
    founder: {
      '@id': `${baseUrl}/#person`,
    },
    sameAs: [
      'https://www.linkedin.com/in/damjansavic/',
      'https://github.com/damjansavic',
    ],
  };

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