import { Stack } from 'expo-router/stack';
import AuthProvider, { useAuth } from '../context/AuthProvider';
import { EXPO_PUBLIC_NODE_ENV } from '@env';
import * as SecureStore from 'expo-secure-store';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { useEffect, useState } from 'react';
import { ActivityIndicator, View } from 'react-native';

export default function RootLayout() {
    const [isLoading, setIsLoading] = useState(true);
    const { user } = useAuth();

    return (
        <GestureHandlerRootView style={{ flex: 1 }}>
            <AuthProvider>
                <Stack>
                    <Stack.Screen name="(auth)/(tabs)" options={{ headerShown: false }} />
                    <Stack.Screen name="(public)/login" options={{ headerShown: false }} />
                    <Stack.Screen name="(public)/registerChooseVehiclesOne" options={{ headerShown: false }} />
                    <Stack.Screen name="(public)/registerChooseVehiclesTwo" options={{ headerShown: false }} />
                    {/* Testing Purpose */}
                    {EXPO_PUBLIC_NODE_ENV == 'development' ? (
                        <Stack.Screen
                            name="(public)/test"
                            options={{
                                headerShown: false,
                                title: 'Test Component Page'
                            }}
                        />
                    ) : (
                        <></>
                    )}
                </Stack>
            </AuthProvider>
        </GestureHandlerRootView>
    );
}
