// src/providers/AppProviders.tsx
import React, { ReactNode } from 'react';
import { AuthProvider } from './AuthProvider';
import { FlyersProvider } from './FlyersProvider';
import { MasterItemsProvider } from './MasterItemsProvider';
import { ModalProvider } from './ModalProvider';
import { UserDataProvider } from './UserDataProvider';

interface AppProvidersProps {
  children: ReactNode;
}

/**
 * A single component to group all application-wide context providers.
 * This cleans up index.tsx and makes the provider hierarchy clear.
 */
export const AppProviders: React.FC<AppProvidersProps> = ({ children }) => {
  return (
    <ModalProvider>
      <AuthProvider>
        <FlyersProvider>
          <MasterItemsProvider>
            <UserDataProvider>{children}</UserDataProvider>
          </MasterItemsProvider>
        </FlyersProvider>
      </AuthProvider>
    </ModalProvider>
  );
};