import { CreateComplexPage } from '@/features/onboard/create-complex-page';
import { createFileRoute, redirect } from '@tanstack/react-router';

export const Route = createFileRoute('/onboard/create-complex')({
  beforeLoad: ({ context }) => {
    const hasSession = context.auth.isAuthenticated;
    const hasPendingSignup = Boolean(sessionStorage.getItem('pending-signup-email'));

    if (!hasSession && !hasPendingSignup) {
      throw redirect({ to: '/onboard' });
    }
  },
  component: CreateComplexPage,
});
