import { isLocale, type Locale, publicPath } from "@/i18n/routes";
import { getDict } from "@/i18n/dictionaries";
import { buildMetadata } from "@/lib/metadata";

export async function generateMetadata({
  params,
}: {
  params: Promise<{ lang: string }>;
}) {
  const { lang } = await params;
  const locale: Locale = isLocale(lang) ? lang : "de";
  return buildMetadata(locale, getDict(locale).privacy.title, "Datenschutz", { path: publicPath(locale, "privacy") });
}

export default async function PrivacyPage({
  params,
}: {
  params: Promise<{ lang: string }>;
}) {
  const { lang } = await params;
  const locale: Locale = isLocale(lang) ? lang : "de";
  const dict = getDict(locale);
  return (
    <article className="ascii-box mx-auto max-w-3xl space-y-4">
      <div className="section-heading">
        <span className="section-heading__label">~/privacy</span>
        <h1 className="section-heading__title">{dict.privacy.title}</h1>
      </div>
      <p>{dict.privacy.body}</p>
    </article>
  );
}
