import { AuthProvider } from "@/contexts/AuthContext";
import { MenuProvider } from "@/contexts/MenuContext";
import { FavoritesProvider } from "@/contexts/FavoritesContext";
import { AppLayout } from "@/components/layout/AppLayout";
import { ApprovalGlobalListener } from "@/components/approval/ApprovalGlobalListener";
import { RequireAuth } from "@/components/auth/AuthGuard";

export default function MainLayout({ children }: { children: React.ReactNode }) {
  return (
    <AuthProvider>
      <RequireAuth>
        <MenuProvider>
          <FavoritesProvider>
            <AppLayout>{children}</AppLayout>
            <ApprovalGlobalListener />
          </FavoritesProvider>
        </MenuProvider>
      </RequireAuth>
    </AuthProvider>
  );
}
