import { Organization, WebSite, WithContext } from 'schema-dts';

export default function JsonLd() {
  const organizationJsonLd: WithContext<Organization> = {
    '@context': 'https://schema.org',
    '@type': 'Organization',
    name: 'KLZ Cables',
    url: 'https://klz-cables.com',
    logo: 'https://klz-cables.com/logo-blue.svg',
    sameAs: [
      'https://www.linkedin.com/company/klz-cables',
    ],
    description: 'Premium Cable Solutions for Renewable Energy and Infrastructure.',
    address: {
      '@type': 'PostalAddress',
      addressCountry: 'DE',
    },
  };

  const websiteJsonLd: WithContext<WebSite> = {
    '@context': 'https://schema.org',
    '@type': 'WebSite',
    name: 'KLZ Cables',
    url: 'https://klz-cables.com',
    potentialAction: {
      '@type': 'SearchAction',
      target: {
        '@type': 'EntryPoint',
        urlTemplate: 'https://klz-cables.com/search?q={search_term_string}',
      },
      // @ts-ignore - schema-dts might not have this specific property but it's valid for Google
      'query-input': 'required name=search_term_string',
    } as any,
  };

  return (
    <script
      type="application/ld+json"
      dangerouslySetInnerHTML={{
        __html: JSON.stringify([organizationJsonLd, websiteJsonLd]),
      }}
    />
  );
}
