import { getTranslations, setRequestLocale } from "next-intl/server";

export default async function PoliciesPage({
  params,
}: {
  params: Promise<{ locale: string }>;
}) {
  const { locale } = await params;
  setRequestLocale(locale);
  const t = await getTranslations("policy");
  const sections = [
    { title: t("googleTitle"), text: t("google") },
    { title: t("adsTitle"), text: t("ads") },
    { title: t("fraudTitle"), text: t("fraud") },
    { title: t("vpnTitle"), text: t("vpn") },
    { title: t("contentTitle"), text: t("content") },
    { title: t("escrowTitle"), text: t("escrow") },
    { title: t("closeTitle"), text: t("close") },
  ];
  return (
    <article className="mx-auto max-w-3xl space-y-6">
      <div className="card p-8">
        <h1 className="page-title">{t("title")}</h1>
        <p className="mt-3 leading-8 text-muted">{t("intro")}</p>
      </div>
      {sections.map((section) => (
        <section key={section.title} className="card p-6">
          <h2 className="text-xl font-semibold">{section.title}</h2>
          <p className="mt-3 leading-8 text-muted">{section.text}</p>
        </section>
      ))}
    </article>
  );
}
