import { useAuth } from '@/contexts/AuthContext';
import { Navigate } from 'react-router-dom';
import { AdminUserProfilesManager } from '@/components/admin/profile';

export default function AdminUserProfilesPage() {
  const { hasPermission, loading, isAuthenticated } = useAuth();
  const Ok = hasPermission('admin.users');

  if (loading) return null;
  if (!isAuthenticated) return <Navigate to="/login" replace />;
  if (!Ok) return <Navigate to="/unauthorized" replace />;

  return <AdminUserProfilesManager />;
}
