"use client";

import { ChakraProvider } from "@chakra-ui/react";
import { system } from "@/theme/theme";
import { SessionProvider } from "next-auth/react";
import { ThemeProvider } from "next-themes";
import ReactQueryProvider from "@/provider/react-query-provider";
import { ToastProvider } from "@/components/ui/toast";

export function Provider({ children }: { children: React.ReactNode }) {
  return (
    <ChakraProvider value={system}>
      <SessionProvider>
        <ReactQueryProvider>
          <ThemeProvider
            attribute="class"
            defaultTheme="dark"
            enableSystem={false}
            disableTransitionOnChange
          >
            <ToastProvider>{children}</ToastProvider>
          </ThemeProvider>
        </ReactQueryProvider>
      </SessionProvider>
    </ChakraProvider>
  );
}
