"use client";

import { ChakraProvider } from "@chakra-ui/react";
import { SessionProvider } from "next-auth/react";
import { ColorModeProvider, type ColorModeProviderProps } from "./color-mode";
import { system } from "../../theme/theme";
import { Toaster } from "./feedback/toaster";
import TopLoader from "./top-loader";
import ReactQueryProvider from "@/providers/react-query-provider";
import AOSProvider from "@/providers/aos-provider";

export function Provider(props: ColorModeProviderProps) {
  return (
    <SessionProvider>
      <ChakraProvider value={system}>
        <ReactQueryProvider>
          <AOSProvider>
            <TopLoader />
            <ColorModeProvider {...props} />
            <Toaster />
          </AOSProvider>
        </ReactQueryProvider>
      </ChakraProvider>
    </SessionProvider>
  );
}
