﻿import { Metadata } from 'next';
import { getLocale, 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('impressumPage.metaData');
  const locale = await getLocale();

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

export default async function ImpressumPage() {
  const t = await getTranslations('impressumPage');
  const locale = await getLocale();
  const content = loadFileSystemContent(locale, 'impresszum');

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