import type { Metadata } from 'next'
import { getTranslations, setRequestLocale } from 'next-intl/server'
import { PageShell } from '@/components/PageShell'
import { RegisterForm } from './RegisterForm'

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

export default async function CreateAccountPage({ params }: { params: Promise<{ locale: string }> }) {
  const { locale } = await params
  setRequestLocale(locale)
  const t = await getTranslations('Register')

  return (
    <PageShell title={t('title')}>
      <div className="box-content" tabIndex={-1}>
        <div className="body-box-content info-box-light justified">
          <p>{t('bnetType')}</p>
          <p>{t('passwordRule')}</p>
          <p>{t('emailRule')}</p>
          <br />
          <p>{t('activation1')}</p>
          <p>{t('activation2')}</p>
          <p>
            <i className="fas fa-exclamation-triangle"></i> {t('loginHint')}
          </p>
        </div>
      </div>
      <div className="box-content">
        <div className="body-box-content centered">
          <RegisterForm />
        </div>
      </div>
    </PageShell>
  )
}
