// components/footerLinks/PrivacyPolicy.tsx
"use client";

import React from "react";
import { WebsiteFooter } from "@/components/website/WebsiteFooter";
import { cn } from "@/lib/utils";
import { WebsiteHeader } from "../website/WebsiteHeader";

interface PrivacyPolicyProps {
  privacyPolicyPageData: {
    privacyPage?: {
      pageTitle?: string;
      pageSubTitle?: string;
      shortContent?: string;
      fullContent?: string;
      seoTitle?: string;
      mainImage?: string;
    };
    headerFooterImage?: any;
    socialLinks?: any[];
  } | null;
}

const PrivacyPolicy = ({ privacyPolicyPageData }: PrivacyPolicyProps) => {
  if (!privacyPolicyPageData?.privacyPage) {
    return (
      <div className="min-h-screen w-full flex items-center justify-center">
        <p className="text-muted-foreground">Loading...</p>
      </div>
    );
  }

  const { pageTitle, shortContent, fullContent } = privacyPolicyPageData.privacyPage;

  return (
    <div className="min-h-screen w-full flex flex-col">

              <WebsiteHeader headerData={privacyPolicyPageData?.headerFooterImage} />

      {/* Main Content - No Header */}
      <div className="flex-1 w-full py-10 px-5 md:px-0 md:max-w-5xl mx-auto text-black dark:invert">
        <h1 className="text-3xl font-bold mt-5">{pageTitle}</h1>
        <div className="w-full h-px bg-border my-4"></div>

        {shortContent && (
          <div
            className={cn(
              "prose max-w-none",
              "list-disc list-outside [&>ul]:list-disc [&>ul]:pl-6",
              "[&>ol]:list-decimal [&>ol]:pl-6",
              "prose-p:text-muted-foreground prose-li:text-muted-foreground",
              "prose-headings:text-foreground prose-strong:text-foreground",
              "leading-relaxed"
            )}
            dangerouslySetInnerHTML={{ __html: shortContent }}
          />
        )}

        {fullContent && (
          <div
            className={cn(
              "prose max-w-none mt-4",
              "[&_a]:text-[#0084A5]",
               "dark:[&_a]:invert",
              "list-disc list-outside [&>ul]:list-disc [&>ul]:pl-6",
              "[&>ol]:list-decimal [&>ol]:pl-6",
              "prose-p:text-muted-foreground prose-li:text-muted-foreground",
              "prose-headings:text-foreground prose-strong:text-foreground",
              "leading-relaxed"
            )}
            dangerouslySetInnerHTML={{ __html: fullContent }}
          />
        )}
      </div>

      {/* Footer */}
      <WebsiteFooter
        footerData={privacyPolicyPageData?.headerFooterImage}
        socialLinks={privacyPolicyPageData?.socialLinks}
      />
    </div>
  );
};

export default PrivacyPolicy;