import React, { ReactNode } from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { AuthProvider } from './AuthContext';
import { ThemeProvider } from './ThemeContext';
import { UIProvider } from './UIContext';
import { ChatProvider } from './ChatContext';

const queryClient = new QueryClient();

interface ProvidersProps {
  children: ReactNode;
}

const Providers: React.FC<ProvidersProps> = ({ children }) => {
  return (
    <UIProvider>
      <QueryClientProvider client={queryClient}>
        <AuthProvider>
          <ThemeProvider>
            <ChatProvider>
              {children}
            </ChatProvider>
          </ThemeProvider>
        </AuthProvider>
      </QueryClientProvider>
    </UIProvider>
  );
};

export default Providers;
