import React from 'react';
import { AuthProvider } from '@/contexts/AuthContext';
import { OrganizationProvider } from '@/contexts/OrganizationContext';
import { PartnershipProvider } from '@/contexts/PartnershipContext';
import { ThemeProvider } from '@/contexts/ThemeContext';
import { UIProvider } from '@/contexts/UIContext';
import { I18nProvider } from '@/hooks/useI18n';
import { QueryProvider } from '@/providers/QueryProvider';

interface AppProviderProps {
  children: React.ReactNode;
}

export const AppProvider: React.FC<AppProviderProps> = ({ children }) => {
  return (
    <I18nProvider>
      <QueryProvider>
        <ThemeProvider storageKey="ui-theme">
          <UIProvider>
            <AuthProvider>
              <OrganizationProvider>
                <PartnershipProvider>{children}</PartnershipProvider>
              </OrganizationProvider>
            </AuthProvider>
          </UIProvider>
        </ThemeProvider>
      </QueryProvider>
    </I18nProvider>
  );
};
