import { Metadata } from 'next';
import { getLocale } from 'next-intl/server';
import { getTranslations } from 'next-intl/server';

import ContentPage from '@/components/ContentPage';
import { loadFileSystemContent } from '@/lib/loadFileSystemContent';
import { getCanonicalUrl } from '@/utils/seo';

export async function generateMetadata(): Promise<Metadata> {
  const t = await getTranslations('privacyPolicyPage.metaData');
  const locale = await getLocale();

  return {
    title: t('title'),
    description: t('description'),
    alternates: {
      canonical: getCanonicalUrl(locale, t('slug')),
    },
  };
}

export default async function PrivacyPolicyPage() {
  const t = await getTranslations('privacyPolicyPage');
  const locale = await getLocale();
  const content = loadFileSystemContent(locale, 'adatkezelesi-tajekoztato');

  return <ContentPage title={t('title')} subTitle={t('subTitle')} markdownContent={content} />;
}
