import { View, Text, Pressable } from 'react-native';
import { useRouter } from 'expo-router';
import { SafeAreaView } from 'react-native-safe-area-context';
import { useTranslation } from 'react-i18next';

/**
 * Shown when the backend returns a device-limit error (HTTP 403 with device_limit_reached).
 * Phase 2: static info + redirect to sign-in.
 * Phase 4+: integrate with device-management store to show active devices + revoke option.
 */
export default function DeviceLimitScreen() {
  const router = useRouter();
  const { t } = useTranslation();

  return (
    <SafeAreaView className="flex-1 bg-white">
      <View className="flex-1 items-center justify-center px-6 text-center">
        <Text className="text-5xl mb-4" style={{ fontFamily: 'Nunito_400Regular' }}>&#x1F4F1;</Text>
        <Text className="text-xl text-neutral-900 mb-3 text-center" style={{ fontFamily: 'Nunito_700Bold' }}>
          {t('auth.deviceLimitTitle')}
        </Text>
        <Text className="text-sm text-neutral-500 text-center leading-6 max-w-xs mb-8" style={{ fontFamily: 'Nunito_400Regular' }}>
          {t('auth.deviceLimitDesc')}
        </Text>

        {/* TODO Phase 4: device management — list active devices + revoke button */}

        <Pressable
          onPress={() => router.replace('/signin')}
          className="bg-rebreak-500 px-8 py-4 rounded-xl active:opacity-80"
        >
          <Text className="text-white text-base" style={{ fontFamily: 'Nunito_600SemiBold' }}>{t('auth.toLogin')}</Text>
        </Pressable>

        <Pressable
          onPress={() => router.push('/signin')}
          className="py-3 mt-2"
        >
          <Text className="text-neutral-500 text-sm" style={{ fontFamily: 'Nunito_400Regular' }}>{t('auth.deviceLimitUpgrade')}</Text>
        </Pressable>
      </View>
    </SafeAreaView>
  );
}
