import { ThemeProvider } from "@mui/material/styles";
import { AppScopeProvider } from "@/app/app-scope/AppScopeProvider.jsx";
import { AuthProvider } from "@/app/auth/AuthProvider.jsx";
import { TimeZoneProvider } from "@/app/timezone/TimeZoneProvider.jsx";
import { ConfirmProvider } from "@/shared/ui/ConfirmProvider.jsx";
import { ToastProvider } from "@/shared/ui/ToastProvider.jsx";
import { QueryProvider } from "@/shared/query/QueryProvider.jsx";
import { RefreshProvider } from "@/shared/hooks/useRefreshSignal.js";
import { theme } from "@/theme.js";

export function AppProviders({ children }) {
  return (
    <ThemeProvider theme={theme}>
      <QueryProvider>
        <ToastProvider>
          <ConfirmProvider>
            <RefreshProvider>
              <AuthProvider>
                <AppScopeProvider>
                  <TimeZoneProvider>
                    {children}
                  </TimeZoneProvider>
                </AppScopeProvider>
              </AuthProvider>
            </RefreshProvider>
          </ConfirmProvider>
        </ToastProvider>
      </QueryProvider>
    </ThemeProvider>
  );
}
