import { SignInForm } from '@/components/auth/SignInForm'
import { isLocale, isMode, type Locale } from '@/lib/localization/config'
import { notFound } from 'next/navigation'
import { Suspense } from 'react'

export default async function SignInPage({
  params,
}: {
  params: Promise<{ locale: string; mode: string }>
}) {
  const { locale: localeValue, mode } = await params
  if (!isLocale(localeValue)) notFound()
  if (!isMode(mode)) notFound()
  const locale = localeValue as Locale

  return (
    <Suspense fallback={null}>
      <SignInForm locale={locale} />
    </Suspense>
  )
}
