'use client';

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
        >
          <AosProvider>
            {children}
            <Toaster />
          </AosProvider>
        </ThemeProvider>
      </TextControlProvider>
    </Provider>
  );
};
