import { getTranslations, setRequestLocale } from 'next-intl/server'
import { ConfirmClient } from '@/components/ConfirmClient'

export default async function Page({ params, searchParams }: { params: Promise<{ locale: string }>; searchParams: Promise<{ hash?: string }> }) {
  const { locale } = await params
  setRequestLocale(locale)
  const { hash } = await searchParams
  const t = await getTranslations('ConfirmOldEmail')
  return (
    <main className="mx-auto max-w-lg px-4 py-12">
      <h1 className="mb-6 text-center text-2xl font-bold text-amber-500">{t('title')}</h1>
      <ConfirmClient hash={hash ?? ''} endpoint="/api/account/confirm-old-email" namespace="ConfirmOldEmail" />
    </main>
  )
}
