import React, { lazy, Suspense } from 'react';
import { Routes, Route, Navigate, useLocation } from 'react-router-dom';
import { RhLayout } from './components/layout/RhLayout';
import { useAuthContext } from '@/components/shared/AuthProvider';
import { LoadingOverlay } from '@/components/shared/LoadingOverlay';
const PageLoader = () => (
);
const RhProtectedRoute = ({ children }) => {
const { user, loading, isAuthorized } = useAuthContext();
const location = useLocation();
if (loading) return ;
if (!user || !isAuthorized('rh')) {
return ;
}
return children;
};
// Lazy Load Views
const RhLoginView = lazy(() => import('./views/RhLoginView').then(m => ({ default: m.RhLoginView })));
const RhDashboardView = lazy(() => import('./views/RhDashboardView').then(m => ({ default: m.RhDashboardView })));
const EmployeesView = lazy(() => import('./views/EmployeesView').then(m => ({ default: m.EmployeesView })));
const PontoPage = lazy(() => import('./ponto-eletronico/components/PontoPage').then(m => ({ default: m.PontoPage })));
/**
* Rotas do módulo de RH.
* Implementa isolamento e estrutura de layout específica.
*/
export const RhRoutes = () => {
return (
}>
{/* Rota de Login do RH */}
} />
{/* Rotas protegidas pelo Layout do RH */}
}>
} />
} />
} />
{/* Redirecionamentos de conveniência */}
} />
} />
);
};