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

import { metaAttributes110 } from '@/utils/filterUtils';

import { redirect } from '@/i18n/navigation';

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

  return {
    title: t('title'),
    description: t('description'),
    alternates: {
      canonical: '/terkep',
    },
    openGraph: {
      url: '/terkep',
      title: t('title'),
      description: t('description'),
      type: 'website',
      locale: 'hu_HU',
    },
    twitter: {
      card: 'summary_large_image',
      title: t('title'),
      description: t('description'),
    },
  };
}

export default async function MapPage({ params }: { params: Promise<{ locale: string }> }) {
  redirect({
    href: `/terkep/${metaAttributes110[0].prettyKey}` as never,
    locale: (await params).locale,
  });
}
