import type { Metadata } from 'next'
import { getTranslations, setRequestLocale } from 'next-intl/server'
import { getRealmName } from '@/lib/realm'
import { GiftPage } from '@/components/GiftPage'

export const dynamic = 'force-dynamic'

export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {
  const { locale } = await params
  const t = await getTranslations({ locale, namespace: 'CharService' })
  return { title: t('sendGift.pageTitle') }
}

export default async function SendGiftPage({ params }: { params: Promise<{ locale: string }> }) {
  const { locale } = await params
  setRequestLocale(locale)
  return <GiftPage locale={locale} realm={await getRealmName()} />
}
