import Container from "@/app/components/shared/container"
import { HeaderWrwpper } from "@/app/components/shared/main-header"
import { getTerms } from "@/lib/serverActions"
import { Icon } from "@iconify/react"
import { Metadata } from "next"
import { getTranslations } from "next-intl/server"

interface LayoutProps {
    params: Promise<{ locale: string | any }> // Handle both promise and object
}
export async function generateMetadata({params}:LayoutProps) : Promise<Metadata> {
    const t = await getTranslations("meta")
    return{
           title: t("terms.title"),
           description: t("terms.description"),
    }
} 
export default async function TermsPage({ params }: LayoutProps) {
    const { locale } = await params
    const t = await getTranslations("Header")

    const { data: terms } = await getTerms(locale)

    return (
        <div className="min-h-[438px] w-full">
            <header>
                <HeaderWrwpper imgUrl={terms?.headerByImage?.image?.original_url}>
                    <div className="flex flex-col items-center justify-center h-full w-full">
                        <div 
                            className="flex flex-col gap-6"
                            data-aos="fade-up"
                            data-aos-duration="800"
                        >
                            <h1 className="text-[24px] lg:text-[40px] font-medium text-center">{t("Terms And Conditions")}</h1>
                            <div className="text-[14px] text-center font-[300px] flex items-center justify-center gap-2">
                                {t("Home")} <Icon className="text-2xl text-[#fff]" icon="weui:arrow-filled" />{" "}
                                {t("Terms And Conditions")}
                            </div>
                        </div>
                    </div>
                </HeaderWrwpper>
            </header>
            <Container className="mt-10 mb-14">
                <div 
                    className=""
                    data-aos="fade-up"
                    data-aos-duration="800"
                    data-aos-delay="200"
                    dangerouslySetInnerHTML={{__html:terms?.data?.description}}
                />
                    {/* {terms?.data?.description}
                </div> */}
            </Container>
        </div>
    )
}
