'use client';

import { TooltipProvider } from '@radix-ui/react-tooltip';
import { Provider } from 'react-redux';

import { TextControlProvider } from '../language';
import { store } from '../store';
import { ThemeProvider } from '../theme/theme-provider';
import { TextItem } from '../types/text.types';
import { AosProvider } from './aos-provider';
import { Toaster } from './toaster';

type ProvidersProps = {
  children: React.ReactNode;
  textItems: TextItem[];
};

export const Providers = ({ children, textItems }: ProvidersProps) => {
  return (
    <Provider store={store}>
      <TextControlProvider textItems={textItems}>
        <ThemeProvider
          attribute='class'
          defaultTheme='light'
          enableSystem
          disableTransitionOnChange
        >
          <TooltipProvider>
            <AosProvider>
              {children}
              <Toaster />
            </AosProvider>
          </TooltipProvider>
        </ThemeProvider>
      </TextControlProvider>
    </Provider>
  );
};
