import { constructMetadata } from "@/lib/seo";
import { siteConfig } from "@/config/site";
import LegalLayout from "@/components/sections/legal/LegalLayout";

export const metadata = constructMetadata({
  title: "Privacy Policy",
  description: "How Cerkel collects, uses, shares and protects your personal data, and the rights you have over it.",
  path: "/privacy",
});

const UPDATED = "17 June 2026";

const SECTIONS = [
  {
    id: "overview",
    heading: "Overview",
    blocks: [
      `This Privacy Policy explains how ${siteConfig.name} ("we", "us", "our") collects, uses, shares and protects personal information when you visit our website, contact us or engage our services. By using our website you agree to the practices described here.`,
      "We are committed to handling your data responsibly and in line with applicable data-protection laws, including the GDPR and CCPA where they apply to you.",
    ],
  },
  {
    id: "information-we-collect",
    heading: "Information we collect",
    blocks: [
      "We collect information you provide directly and information collected automatically when you use our website:",
      [
        "Information you provide — name, email, phone number, company, and the contents of any message, brief or application you submit.",
        "Usage data — pages visited, referring URLs, time on page and similar analytics collected via cookies and similar technologies.",
        "Device data — IP address, browser type, operating system and approximate location.",
      ],
    ],
  },
  {
    id: "how-we-use",
    heading: "How we use your information",
    blocks: [
      "We use the information we collect to:",
      [
        "Respond to your enquiries and provide the services you request.",
        "Operate, maintain and improve our website and offerings.",
        "Send you relevant communications where you have asked us to or where we have a legitimate interest.",
        "Analyse usage to understand and improve performance and content.",
        "Comply with legal obligations and protect our rights.",
      ],
    ],
  },
  {
    id: "cookies",
    heading: "Cookies & tracking",
    blocks: [
      "We use cookies and similar technologies to run the site, remember your preferences and measure performance. You can control cookies through your browser settings; disabling some cookies may affect how the site works.",
    ],
  },
  {
    id: "how-we-share",
    heading: "How we share information",
    blocks: [
      "We do not sell your personal information. We share it only where necessary:",
      [
        "Service providers — trusted vendors (e.g. hosting, analytics, email) who process data on our behalf under appropriate agreements.",
        "Legal reasons — where required by law, regulation or valid legal process, or to protect rights and safety.",
        "Business transfers — in connection with a merger, acquisition or sale of assets, subject to this policy.",
      ],
    ],
  },
  {
    id: "data-retention",
    heading: "Data retention",
    blocks: [
      "We keep personal information only for as long as needed to fulfil the purposes described here, to comply with our legal obligations, resolve disputes and enforce our agreements. When it is no longer needed, we delete or anonymise it.",
    ],
  },
  {
    id: "data-security",
    heading: "Data security",
    blocks: [
      "We use appropriate technical and organisational measures — including encryption in transit, access controls and regular reviews — to protect your information. No method of transmission or storage is completely secure, so we cannot guarantee absolute security.",
    ],
  },
  {
    id: "your-rights",
    heading: "Your rights",
    blocks: [
      "Depending on where you live, you may have the right to:",
      [
        "Access the personal information we hold about you.",
        "Request correction of inaccurate or incomplete data.",
        "Request deletion of your data.",
        "Object to or restrict certain processing.",
        "Request a portable copy of your data.",
        "Withdraw consent at any time, where processing is based on consent.",
      ],
      `To exercise any of these rights, contact us at ${siteConfig.contact.email}. We will respond within the timeframes required by applicable law.`,
    ],
  },
  {
    id: "international-transfers",
    heading: "International transfers",
    blocks: [
      "We operate globally, so your information may be processed in countries other than your own. Where we transfer data internationally, we use appropriate safeguards to protect it in line with applicable law.",
    ],
  },
  {
    id: "childrens-privacy",
    heading: "Children's privacy",
    blocks: [
      "Our website and services are not directed to children under 16, and we do not knowingly collect personal information from them. If you believe a child has provided us with data, please contact us and we will delete it.",
    ],
  },
  {
    id: "third-party-links",
    heading: "Third-party links",
    blocks: [
      "Our website may link to third-party sites we do not control. This policy does not apply to those sites, and we encourage you to review their privacy practices.",
    ],
  },
  {
    id: "changes",
    heading: "Changes to this policy",
    blocks: [
      "We may update this Privacy Policy from time to time. When we do, we will revise the “Last updated” date above and, where appropriate, notify you. Your continued use of the website after changes take effect constitutes acceptance of the updated policy.",
    ],
  },
  {
    id: "contact",
    heading: "Contact us",
    blocks: [
      `If you have questions about this policy or how we handle your data, contact us at ${siteConfig.contact.email}.`,
    ],
  },
];

export default function PrivacyPage() {
  return (
    <LegalLayout
      title="Privacy Policy"
      updated={UPDATED}
      intro={`Your privacy matters to us. This policy explains what data ${siteConfig.name} collects, why, and the choices you have.`}
      sections={SECTIONS}
    />
  );
}
