import '../global.css';

import { DarkTheme, ThemeProvider } from '@react-navigation/native';
import { Stack } from 'expo-router';
// import { Platform } from 'react-native';
// import { useEffect } from 'react';
import 'react-native-reanimated';

import { AuthProvider } from '@/components/auth/auth-provider';

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

export default function RootLayout() {
  // useEffect(() => {
  //   const initializeClarity = async () => {
  //     if (Platform.OS === 'android' || Platform.OS === 'ios') {
  //       try {
  //         const ClarityModule = require('@microsoft/react-native-clarity');
  //         const Clarity = ClarityModule.default || ClarityModule;

  //         if (Clarity && typeof Clarity.initialize === 'function') {
  //           await Clarity.initialize('tyq6bmjzo1', {
  //             logLevel: Clarity.LogLevel?.Verbose,
  //           });
  //         }
  //       } catch (error) {
  //         console.warn('Clarity initialization failed:', error);
  //       }
  //     }
  //   };

  //   initializeClarity();
  // }, []);

  return (
    <ThemeProvider value={DarkTheme}>
      <AuthProvider>
        <Stack>
          <Stack.Screen name="(tabs)" options={{ headerShown: false }} />
          <Stack.Screen name="modal" options={{ presentation: 'modal', title: 'Modal' }} />
          <Stack.Screen name="result" options={{ headerShown: false }} />
          <Stack.Screen name="exchange" options={{ headerShown: false }} />
        </Stack>
      </AuthProvider>
    </ThemeProvider>
  );
}
