"use client";

import { SidebarProvider } from "@/components/Layouts/sidebar/sidebar-context";
import { UserProvider } from "@/contexts";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ThemeProvider } from "next-themes";
import { ToastContainer, Zoom } from "react-toastify";

const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      retry: false,
    },
  },
});
export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <ThemeProvider defaultTheme="light" attribute="class">
      <UserProvider>
        <SidebarProvider>
          <QueryClientProvider client={queryClient}>
            <ToastContainer
              position="top-right"
              autoClose={2500}
              theme={"colored"}
              transition={Zoom}
              hideProgressBar
              newestOnTop
              closeOnClick
              pauseOnFocusLoss
              draggable
              pauseOnHover
            />
            {children}
          </QueryClientProvider>
        </SidebarProvider>
      </UserProvider>
    </ThemeProvider>
  );
}
