import {
  DarkTheme,
  DefaultTheme,
  ThemeProvider,
} from "@react-navigation/native";
import { Stack } from "expo-router";
import { StatusBar } from "expo-status-bar";
import "react-native-reanimated";

import { PrivacyPopup } from "@/components/PrivacyPopup";
import { AuthProvider } from "@/contexts/AuthContext";
import { useColorScheme } from "@/hooks/use-color-scheme";
import { LogBox } from "react-native";
import { PaperProvider } from "react-native-paper";

// Disable all yellow box warnings
LogBox.ignoreAllLogs(true);

export const unstable_settings = {
  anchor: "(tabs)",
};

export default function RootLayout() {
  const colorScheme = useColorScheme();

  return (
    <PaperProvider>
      <AuthProvider>
        <ThemeProvider
          value={colorScheme === "dark" ? DarkTheme : DefaultTheme}
        >
          <Stack>
            <Stack.Screen
              name="(tabs)"
              options={{ headerShown: false, title: "" }}
            />
            <Stack.Screen name="login" options={{ headerShown: false }} />
            <Stack.Screen
              name="product/[id]"
              options={{ headerShown: false }}
            />
            <Stack.Screen name="address" options={{ headerShown: false }} />
            <Stack.Screen name="orders" options={{ headerShown: false }} />
            <Stack.Screen
              name="award-detail"
              options={{ headerShown: false }}
            />
            <Stack.Screen
              name="award-detail-yfs"
              options={{ headerShown: false }}
            />
            <Stack.Screen name="boxInBox" options={{ headerShown: false }} />
            <Stack.Screen name="dimension" options={{ headerShown: false }} />
            <Stack.Screen name="coupon" options={{ headerShown: false }} />
            <Stack.Screen name="store" options={{ headerShown: false }} />
            <Stack.Screen name="magic" options={{ headerShown: false }} />
            <Stack.Screen name="integral" options={{ headerShown: false }} />
            <Stack.Screen name="message" options={{ headerShown: false }} />
            <Stack.Screen name="exchange" options={{ headerShown: false }} />
            <Stack.Screen name="feedback" options={{ headerShown: false }} />
            <Stack.Screen name="setting" options={{ headerShown: false }} />
            <Stack.Screen name="agreement" options={{ headerShown: false }} />
            <Stack.Screen name="profile" options={{ headerShown: false }} />
            <Stack.Screen name="test" options={{ headerShown: false }} />
            <Stack.Screen name="lottery" options={{ headerShown: false }} />
            <Stack.Screen name="certification" options={{ headerShown: false }} />
            <Stack.Screen
              name="modal"
              options={{ presentation: "modal", title: "Modal" }}
            />
          </Stack>
          <StatusBar style="auto" />
        </ThemeProvider>
      </AuthProvider>
      <PrivacyPopup />
    </PaperProvider>
  );
}
