// Path: src/app/admin/register/page.tsx
// Tester sign-up — exists only while ADMIN_TEST_REGISTRATION_ENABLED=true
// (see lib/auth/testRegistration.ts); otherwise a plain 404.
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { connection } from "next/server";
import AdminAuthCard from "@/components/admin/auth/AdminAuthCard";
import { AdminRegisterForm } from "@/components/admin/auth/AdminPasswordForms";
import { isTestRegistrationEnabled } from "@/lib/auth/testRegistration";

export const metadata: Metadata = {
  title: "Create testing account",
  robots: { index: false, follow: false },
};

export default async function AdminRegisterPage() {
  // Read the env flag per request, not frozen at build time.
  await connection();
  if (!isTestRegistrationEnabled()) notFound();

  return (
    <AdminAuthCard title="Create testing account" subtitle="Your own account for testing this demo">
      <AdminRegisterForm />
    </AdminAuthCard>
  );
}
