import type { Metadata } from "next";
import { getTranslations } from "next-intl/server";
import { Navbar } from "@/components/layout/navbar";
import { Footer } from "@/components/layout/footer";
import { PricingSection } from "@/components/sections/pricing-section";
import { Faq } from "@/components/sections/faq";
import { CtaBanner } from "@/components/sections/cta-banner";
import { JsonLd } from "@/components/seo/json-ld";

const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir";

export async function generateMetadata({
  params,
}: {
  params: Promise<{ locale: string }>;
}): Promise<Metadata> {
  const { locale } = await params;
  const t = await getTranslations({ locale, namespace: "meta" });
  return {
    title: t("pricingTitle"),
    description: t("pricingDesc"),
    alternates: {
      canonical: `${BASE_URL}/${locale}/pricing`,
      languages: { fa: `${BASE_URL}/fa/pricing`, en: `${BASE_URL}/en/pricing` },
    },
    openGraph: { title: t("pricingTitle"), description: t("pricingDesc"), url: `${BASE_URL}/${locale}/pricing` },
  };
}

export default async function PricingPage({ params }: { params: Promise<{ locale: string }> }) {
  const { locale } = await params;
  return (
    <>
      <JsonLd type="FAQPage" locale={locale} />
      <Navbar />
      <main className="pt-16">
        <PricingSection />
        <Faq />
        <CtaBanner />
      </main>
      <Footer />
    </>
  );
}
