import { Navigate } from 'react-router-dom';
import type { ReactNode } from 'react';
import { authStorage } from '@ema-platform/auth';

interface ProfileGuardProps {
  children?: ReactNode;
}

export function ProfileGuard({ children }: ProfileGuardProps) {
  const profileId = authStorage.getProfileId();

  if (!profileId) {
    return <Navigate to="/profile-setup" replace />;
  }

  return <>{children}</>;
}
