import OnBoardingSlider from "./(screens)/OnBoardingScreen";
import { storage } from "@/configs/storage";
import { TOKEN_NAME } from "@/configs";
import { Redirect } from "expo-router";

export default function App() {
  const onboarding = storage.getString("onboarding");
  const token = storage.getString(TOKEN_NAME);

  // First time user - show onboarding
  if (onboarding !== "false") {
    return <OnBoardingSlider />;
  }

  // Has token - go to tabs
  if (token) {
    return <Redirect href={"/(tabs)" as any} />;
  }

  // No token - go to sign in
  return <Redirect href={"/(auth)/sign-in" as any} />;
}
