'use client'

import Link from 'next/link'
import { useLang } from '@/context/LangContext'
import { siteConfig } from '@/lib/site'

const CONTENT = {
  de: {
    title: 'Impressum',
    companyLabel: 'Unternehmen',
    addressLabel: 'Adresse',
    representativeLabel: 'Vertretungsberechtigt',
    contactLabel: 'Kontakt',
    registryLabel: 'Register',
    vatLabel: 'USt-ID',
  },
  en: {
    title: 'Imprint',
    companyLabel: 'Company',
    addressLabel: 'Address',
    representativeLabel: 'Represented by',
    contactLabel: 'Contact',
    registryLabel: 'Registry',
    vatLabel: 'VAT ID',
  },
  es: {
    title: 'Aviso Legal',
    companyLabel: 'Empresa',
    addressLabel: 'Direccion',
    representativeLabel: 'Representante',
    contactLabel: 'Contacto',
    registryLabel: 'Registro',
    vatLabel: 'IVA',
  },
}

export default function ImprintContent() {
  const { lang } = useLang()
  const c = CONTENT[lang]

  return (
    <main className="container" style={{ paddingTop: '8rem', paddingBottom: '8rem', maxWidth: '800px' }}>
      <p style={{ marginBottom: '1rem', opacity: 0.75 }}>
        <Link href="/">Home</Link> / <span>Legal</span> / <span>{c.title}</span>
      </p>
      <h1>{c.title}</h1>
      <div style={{ marginTop: '2rem', lineHeight: '1.8', opacity: 0.9 }}>
        <p>
          <strong>{c.companyLabel}:</strong> {siteConfig.company.legalName}
        </p>
        {siteConfig.company.addressLine1 ? (
          <p><strong>{c.addressLabel}:</strong> {siteConfig.company.addressLine1}</p>
        ) : null}
        {siteConfig.company.addressLine2 ? <p>{siteConfig.company.addressLine2}</p> : null}
        <p>{siteConfig.company.country}</p>
        <p>
          <strong>{c.representativeLabel}:</strong> {siteConfig.company.representative}
        </p>
        <p>
          <strong>{c.contactLabel}:</strong> <a href={`mailto:${siteConfig.legalEmail}`}>{siteConfig.legalEmail}</a>
        </p>
        {siteConfig.company.registry ? (
          <p><strong>{c.registryLabel}:</strong> {siteConfig.company.registry}</p>
        ) : null}
        {siteConfig.company.vatId ? (
          <p><strong>{c.vatLabel}:</strong> {siteConfig.company.vatId}</p>
        ) : null}
      </div>
    </main>
  )
}
