import { Stack } from "expo-router";
import React, { useState } from "react";
import SignInScreen from "@/components/auth/SignInScreen";
import { 
  PushNotificationManager
} from "@/components/services/notifications/PushNotificationManager";

const RootLayout = () => {
  const [isSignedIn, setIsSignedIn] = useState(false);
  console.log('RootLayout rendering, isSignedIn:', isSignedIn);
  if (!isSignedIn) {
    console.log('Rendering SignInScreen');
    return (
    <SignInScreen onSignIn={() => setIsSignedIn(true)} />
    );
  }
  console.log('PushNotificationManager & Stack');
  return (
    <PushNotificationManager>
      <Stack>
        <Stack.Screen name="(tabs)" options={{ headerShown: false }} />
        <Stack.Screen name="+not-found" />
      </Stack>
    </PushNotificationManager>
  );
}
export default RootLayout;
