import { getTranslations, setRequestLocale } from "next-intl/server";
import { Link } from "@/i18n/navigation";
import { RegisterForm } from "@/components/forms";

export default async function RegisterPage({
  params,
  searchParams,
}: {
  params: Promise<{ locale: string }>;
  searchParams: Promise<{ ref?: string }>;
}) {
  const { locale } = await params;
  const query = await searchParams;
  setRequestLocale(locale);
  const t = await getTranslations("auth");
  return (
    <div className="space-y-4">
      <RegisterForm refCode={query.ref ?? ""} />
      <p className="text-center text-sm">
        {t("toLogin")}{" "}
        <Link className="text-brand" href="/login">
          {t("submitLogin")}
        </Link>
      </p>
    </div>
  );
}
