import { loadDictionary } from "@allai/i18n/server";
import { Locale, resolveLocale } from "@/config/i18n";
import { PublicShell } from "@/components/layouts/PublicShell";
import { RegisterForm } from "@/features/auth/components/RegisterForm";

type PageProps = {
  params: { locale: string };
};

export default async function RegisterPage({ params }: PageProps) {
  const locale = resolveLocale(params.locale);
  const dictionary = await loadDictionary(locale);
  const auth = dictionary.auth;

  return (
    <PublicShell locale={locale as Locale}>
      <h1 style={{ fontSize: 32, fontWeight: 700, marginBottom: 12 }}>{auth.registerTitle}</h1>
      <p style={{ color: "var(--color-muted)", maxWidth: 420, margin: "0 auto 24px" }}>{auth.registerSubtitle}</p>
      <RegisterForm
        labels={{
          emailLabel: auth.emailLabel,
          passwordLabel: auth.passwordLabel,
          confirmPasswordLabel: auth.confirmPasswordLabel,
          submitLabel: auth.submitRegister,
          orDivider: auth.orDivider,
          googleLabel: auth.googleButton,
          loginCta: auth.loginCta,
          loginLink: auth.loginLink,
          errorGeneric: auth.errorGeneric,
          passwordMismatch: auth.passwordMismatch
        }}
      />
    </PublicShell>
  );
}
