import { notFound, permanentRedirect } from 'next/navigation'
import { getGermanSeoPageBySlug, germanSeoPageSlugs } from '@/lib/seoPages'

type GermanSeoRouteProps = {
  params: Promise<{ slug: string }>
}

export function generateStaticParams() {
  return germanSeoPageSlugs.map((slug) => ({ slug }))
}

export default async function GermanSeoRoute({ params }: GermanSeoRouteProps) {
  const { slug } = await params
  const profile = getGermanSeoPageBySlug(slug)

  if (!profile) {
    notFound()
  }

  permanentRedirect(`/${slug}`)
}
