import { redirect } from 'next/navigation'
import { getSessionUser } from '@/lib/auth'
import { PilotSignupWizard } from './pilot-signup-wizard'

/**
 * Pilot signup replica — INTERNAL ONLY (Phase 1, 2026-09-12).
 *
 * Nash: "everything that's test is for admin only to view." Gated on the
 * session's `internal` flag like every other preview tool (Task 96): a signed
 * -out visitor goes to login, a customer goes to their dashboard. When real
 * pilot self-signup ships this page becomes public and the gate goes away.
 */
export default async function PilotSignupPreviewPage() {
  const user = await getSessionUser()
  if (!user) redirect('/login?next=%2Fsignup%2Fpilot')
  if (!user.internal) redirect('/dashboard')
  return <PilotSignupWizard />
}
