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

export const metadata = constructMetadata({
  title: "Terms of Service",
  description: "The terms that govern your use of Cerkel's website and services.",
  path: "/terms",
});

const UPDATED = "17 June 2026";

const SECTIONS = [
  {
    id: "acceptance",
    heading: "Acceptance of terms",
    blocks: [
      `These Terms of Service ("Terms") govern your access to and use of the ${siteConfig.name} website and services. By accessing or using the website, you agree to be bound by these Terms. If you do not agree, please do not use the website.`,
    ],
  },
  {
    id: "use-of-website",
    heading: "Use of the website",
    blocks: [
      "You may use our website for lawful purposes only. You agree not to use it in any way that could damage, disable or impair the site, or interfere with anyone else's use of it.",
      "We may modify, suspend or discontinue any part of the website at any time without notice.",
    ],
  },
  {
    id: "services",
    heading: "Services & engagements",
    blocks: [
      "Information on this website about our services is for general information and does not constitute an offer. Any engagement for services is governed by a separate written agreement (such as a statement of work or master services agreement) signed by both parties, which takes precedence over these Terms for that engagement.",
    ],
  },
  {
    id: "intellectual-property",
    heading: "Intellectual property",
    blocks: [
      `All content on this website — including text, graphics, logos, designs and code — is owned by ${siteConfig.name} or its licensors and is protected by intellectual-property laws. You may not copy, reproduce, distribute or create derivative works from it without our prior written permission.`,
      "Ownership of work product created during a client engagement is governed by the relevant engagement agreement.",
    ],
  },
  {
    id: "user-content",
    heading: "User content & submissions",
    blocks: [
      "If you submit content to us (for example through a contact or application form), you confirm you have the right to share it and grant us a license to use it for the purpose for which it was submitted. You are responsible for the accuracy and legality of anything you submit.",
    ],
  },
  {
    id: "acceptable-use",
    heading: "Acceptable use",
    blocks: [
      "You agree not to:",
      [
        "Use the website for any unlawful, fraudulent or harmful purpose.",
        "Attempt to gain unauthorised access to our systems or data.",
        "Introduce viruses, malware or other harmful code.",
        "Scrape, harvest or collect data from the site without permission.",
        "Infringe the rights of others or violate any applicable law.",
      ],
    ],
  },
  {
    id: "third-party",
    heading: "Third-party links & services",
    blocks: [
      "Our website may contain links to third-party websites or services we do not control. We are not responsible for their content, policies or practices, and including a link does not imply endorsement.",
    ],
  },
  {
    id: "disclaimers",
    heading: "Disclaimers",
    blocks: [
      'The website and its content are provided "as is" and "as available" without warranties of any kind, whether express or implied, including warranties of merchantability, fitness for a particular purpose and non-infringement. We do not warrant that the website will be uninterrupted, error-free or secure.',
    ],
  },
  {
    id: "limitation-of-liability",
    heading: "Limitation of liability",
    blocks: [
      `To the fullest extent permitted by law, ${siteConfig.name} and its team will not be liable for any indirect, incidental, special, consequential or punitive damages, or any loss of profits or data, arising from your use of the website, even if we have been advised of the possibility of such damages.`,
    ],
  },
  {
    id: "indemnification",
    heading: "Indemnification",
    blocks: [
      `You agree to indemnify and hold harmless ${siteConfig.name} and its team from any claims, damages, liabilities and expenses arising out of your use of the website or your breach of these Terms.`,
    ],
  },
  {
    id: "confidentiality",
    heading: "Confidentiality",
    blocks: [
      "Any confidential information exchanged during discussions or engagements is treated as confidential and used only for the agreed purpose. We are happy to sign a mutual non-disclosure agreement before sharing sensitive information.",
    ],
  },
  {
    id: "governing-law",
    heading: "Governing law",
    blocks: [
      "These Terms are governed by the laws of the jurisdiction in which we operate, without regard to conflict-of-laws principles. Any disputes will be subject to the exclusive jurisdiction of the courts of that location, unless otherwise agreed in writing.",
    ],
  },
  {
    id: "changes",
    heading: "Changes to these terms",
    blocks: [
      "We may update these Terms from time to time. When we do, we will revise the “Last updated” date above. Your continued use of the website after changes take effect constitutes acceptance of the updated Terms.",
    ],
  },
  {
    id: "contact",
    heading: "Contact us",
    blocks: [
      `If you have any questions about these Terms, contact us at ${siteConfig.contact.email}.`,
    ],
  },
];

export default function TermsPage() {
  return (
    <LegalLayout
      title="Terms of Service"
      updated={UPDATED}
      intro="Please read these terms carefully — they govern your use of our website and services."
      sections={SECTIONS}
    />
  );
}
