import { ActivityIndicator, Pressable, Text, View } from "react-native";
import { useAuth } from "@/utils/AuthProvider";

export default function Index() {
  const { login, isLoading: authLoading } = useAuth();

  if (authLoading) {
    return (
      <View className="flex-1 justify-center items-center bg-white">
        <ActivityIndicator size="large" />
      </View>
    );
  }

  return (
    <View className="flex-1 bg-white px-4 justify-center items-center">
      <Pressable
        className="w-full flex-row justify-center items-center bg-black py-3 rounded-lg"
        onPress={login}
      >
        <Text className="text-white text-center font-semibold ml-2">
          Sign in with Keycloak
        </Text>
      </Pressable>
    </View>
  );
}
