import React from 'react';
import { StatusBar } from 'expo-status-bar';
import { ApolloProvider } from '@apollo/client';
import { Provider as PaperProvider, MD3DarkTheme, configureFonts } from 'react-native-paper';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { apolloClient } from './src/services/apollo-client';
import { AuthProvider } from './src/contexts/AuthContext';
import { AppNavigator } from './src/navigation/AppNavigator';

// Кастомная темная тема в черно-фиолетовых тонах
const theme = {
  ...MD3DarkTheme,
  colors: {
    ...MD3DarkTheme.colors,
    primary: '#9333ea',
    secondary: '#a855f7',
    tertiary: '#7c3aed',
    background: '#0a0a0f',
    surface: '#1a1a2e',
    surfaceVariant: '#2d2d42',
    onSurface: '#ffffff',
    onSurfaceVariant: '#e5e5e7',
    onPrimary: '#ffffff',
    elevation: {
      level0: 'transparent',
      level1: '#1a1a2e',
      level2: '#2d2d42',
      level3: '#3d3d56',
      level4: '#4d4d6a',
      level5: '#5d5d7e',
    },
    outline: '#7c3aed',
    outlineVariant: '#6d28d9',
    error: '#ef4444',
  },
  roundness: 12,
};

export default function App() {
  return (
    <SafeAreaProvider>
      <ApolloProvider client={apolloClient}>
        <PaperProvider theme={theme}>
          <AuthProvider>
            <AppNavigator />
            <StatusBar style="light" />
          </AuthProvider>
        </PaperProvider>
      </ApolloProvider>
    </SafeAreaProvider>
  );
}
