import type { Metadata } from "next"
import { ToolPageTemplate } from "@/components/tools/tool-page-template"
import { siteConfig, toolPages } from "@/lib/data"

const toolData = toolPages.find(t => t.slug === "legal-document-analysis")!

export const metadata: Metadata = {
  title: toolData.title,
  description: toolData.metaDescription,
  keywords: toolData.keywords,
  openGraph: {
    title: `${toolData.title} | ${siteConfig.name}`,
    description: toolData.metaDescription,
    url: `${siteConfig.url}/legal-document-analysis`,
    siteName: siteConfig.name,
    type: "website",
  },
  twitter: {
    card: "summary_large_image",
    title: `${toolData.title} | ${siteConfig.name}`,
    description: toolData.metaDescription,
  },
  alternates: {
    canonical: `${siteConfig.url}/legal-document-analysis`,
  },
}

const features = [
  {
    icon: "FileText",
    title: "Contract Analysis AI",
    description: "Extract clauses, indemnities, termination terms, liabilities, and obligations instantly."
  },
  {
    icon: "AlertTriangle",
    title: "Risk & Compliance Detection",
    description: "Identify potential legal risks and compliance issues across documents."
  },
  {
    icon: "Scale",
    title: "Case Law Summarization",
    description: "Summarize court judgments and precedents into structured legal insights."
  }
]

const howItWorks = [
  {
    number: 1,
    title: "Upload Document",
    description: "Upload contract, agreement, or case file securely."
  },
  {
    number: 2,
    title: "AI Clause & Theme Detection",
    description: "AI identifies key themes, obligations, and risk areas."
  },
  {
    number: 3,
    title: "Get Structured Legal Insights",
    description: "Receive summaries, clause breakdown, and structured analysis."
  }
]

const userTypes = [
  { title: "Law Firms", description: "Review contracts and case files faster." },
  { title: "Corporate Legal", description: "Analyze agreements & vendor contracts efficiently." },
  { title: "Compliance Teams", description: "Track regulatory risks and policy changes." },
  { title: "Legal Researchers", description: "Summarize judgments & legal literature quickly." }
]

const benefits = [
  {
    icon: "ShieldCheck",
    title: "Zero Hallucination Guarantee",
    description: "AI strictly analyzes provided legal documents only."
  },
  {
    icon: "Lock",
    title: "Secure & Confidential",
    description: "Your legal data is processed securely and not reused."
  },
  {
    icon: "ListChecks",
    title: "Structured Legal Insights",
    description: "Get clause-wise breakdown and theme-based summaries."
  }
]

export default function LegalDocumentAnalysisPage() {
  return (
    <>
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{
          __html: JSON.stringify({
            "@context": "https://schema.org",
            "@type": "SoftwareApplication",
            "name": toolData.title,
            "applicationCategory": "BusinessApplication",
            "operatingSystem": "Web",
            "description": toolData.metaDescription,
            "offers": {
              "@type": "Offer",
              "price": "0",
              "priceCurrency": "USD"
            },
            "featureList": [
              "Contract Analysis",
              "Risk & Compliance Detection",
              "Case Law Summarization",
              "Zero Hallucination Guarantee",
              "Clause-wise Breakdown"
            ]
          })
        }}
      />
      <ToolPageTemplate
        title={toolData.title}
        subtitle={toolData.subtitle}
        description={toolData.description}
        ctaText="Analyze Document"
        whatIsTitle="What is AI Legal Document Analysis?"
        whatIsDescription="AI Legal Document Analysis automatically reviews and extracts key clauses, obligations, risks, precedents, and legal insights from contracts, judgments, and regulatory documents. Instead of manually reviewing hundreds of pages, legal professionals receive structured and reliable analysis within seconds."
        features={features}
        featuresTitle="Advanced Legal AI Features"
        featuresSubtitle="Built for law firms, compliance teams & legal researchers"
        howItWorks={howItWorks}
        userTypes={userTypes}
        userTypesTitle="Who Uses Legal Document AI?"
        benefits={benefits}
        benefitsTitle="Why Choose CodeframeAI for Legal Analysis?"
        finalCta={{
          title: "Transform Legal Documents into Clear Structured Insights",
          description: "Save hours of manual review with AI-powered legal analysis.",
          buttonText: "Get Started Free"
        }}
      />
    </>
  )
}
