import { StatusBar } from 'expo-status-bar';
import React, { useEffect } from 'react';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { SessionProvider } from './src/auth/session';
import { getDb } from './src/db/database';
import { RootNavigator } from './src/navigation';

export default function App() {
  // Abre y migra la BD local al arrancar.
  useEffect(() => {
    void getDb();
  }, []);

  return (
    <SafeAreaProvider>
      <SessionProvider>
        <RootNavigator />
        <StatusBar style="light" />
      </SessionProvider>
    </SafeAreaProvider>
  );
}
