import '../global.css';
import { AuthProvider } from '@/utils/authContext';
import { Stack } from 'expo-router';
import { AlertProvider } from '@/components/AlertComponent';
import { NetworkProvider } from '@/utils/networkProvider';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { KeyboardProvider } from "react-native-keyboard-controller";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { ConfigProvider } from '@/utils/configProvider';

export default function AppLayout() {
    return (
        <SafeAreaProvider>
            <GestureHandlerRootView>
                <KeyboardProvider>
                    <NetworkProvider>
                        <ConfigProvider>
                            <AuthProvider>
                                <AlertProvider>
                                    <Stack screenOptions={{ headerShown: false, animation: 'flip' }}>
                                        <Stack.Screen name="(protected)" />
                                        <Stack.Screen name="login" />
                                        <Stack.Screen name="forgot-password" />
                                    </Stack>
                                </AlertProvider>
                            </AuthProvider>
                        </ConfigProvider>
                    </NetworkProvider>
                </KeyboardProvider>
            </GestureHandlerRootView>
        </SafeAreaProvider>
    );
}
