/*
 * 루트 레이아웃 — AuthProvider + 네이티브 스택 내비.
 * 모바일은 MDI 미적용(단일 화면 포커스, design.md §2-2).
 */
import { Stack } from 'expo-router';
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { AuthProvider } from '../context/AuthContext';
import { SecureScreenProvider } from '../context/SecureScreenContext';
import { colors } from '../theme';

export default function RootLayout() {
  return (
    <GestureHandlerRootView style={{ flex: 1 }}>
      <SafeAreaProvider>
        <AuthProvider>
          <SecureScreenProvider>
          <StatusBar style="dark" />
          <Stack
            screenOptions={{
              headerStyle: { backgroundColor: colors.white },
              headerTintColor: colors.neutral900,
              headerTitleStyle: { fontWeight: '600' },
              contentStyle: { backgroundColor: colors.neutral050 },
            }}
          >
            <Stack.Screen name="index" options={{ headerShown: false }} />
            <Stack.Screen name="login" options={{ headerShown: false }} />
            <Stack.Screen name="register" options={{ title: '회원가입' }} />
            <Stack.Screen name="forgot-password" options={{ title: '비밀번호 찾기' }} />
            <Stack.Screen name="(tabs)" options={{ headerShown: false }} />
            <Stack.Screen name="profile" options={{ title: '내 정보' }} />
            <Stack.Screen name="checklist" options={{ title: '현장 체크리스트' }} />
            <Stack.Screen name="inspection" options={{ title: '현장 검수' }} />
            <Stack.Screen name="tickets/index" options={{ title: '내 티켓' }} />
            <Stack.Screen name="tickets/select" options={{ title: '티켓 예매' }} />
          </Stack>
          </SecureScreenProvider>
        </AuthProvider>
      </SafeAreaProvider>
    </GestureHandlerRootView>
  );
}
