import { Text, View } from 'react-native';
import { useTranslation } from 'react-i18next';
import { Ionicons } from '@expo/vector-icons';
import { useColors } from '../../../lib/theme';
import { OnboardingShell } from '../OnboardingShell';
import { LyraBubble } from '../LyraBubble';
import { CTABar } from '../CTABar';

/**
 * Slide 1: Lyra stellt sich vor + erklärt die Mission in einem Satz.
 * Hat den langen Empathie-Touch, weil's der erste Eindruck nach Signup ist.
 */
export function WelcomeSlide({
  onNext,
  current,
  total,
}: {
  onNext: () => void;
  current: number;
  total: number;
}) {
  const { t } = useTranslation();
  const colors = useColors();

  return (
    <OnboardingShell
      current={current}
      total={total}
      cta={<CTABar primaryLabel={t('onboarding.welcome.cta_primary')} onPrimary={onNext} />}
    >
      <LyraBubble text={t('onboarding.lyra.welcome.body')} emotion="happy" />

      <View style={{ marginTop: 28, gap: 12 }}>
        <BulletRow
          icon="eye-off-outline"
          text={t('onboarding.welcome.bullet_anon')}
          colors={colors}
        />
        <BulletRow
          icon="shield-checkmark-outline"
          text={t('onboarding.welcome.bullet_protect')}
          colors={colors}
        />
        <BulletRow
          icon="people-outline"
          text={t('onboarding.welcome.bullet_community')}
          colors={colors}
        />
      </View>
    </OnboardingShell>
  );
}

function BulletRow({
  icon,
  text,
  colors,
}: {
  icon: keyof typeof Ionicons.glyphMap;
  text: string;
  colors: import('../../../lib/theme').ColorScheme;
}) {
  return (
    <View style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>
      <View
        style={{
          width: 36,
          height: 36,
          borderRadius: 12,
          backgroundColor: colors.surfaceElevated,
          alignItems: 'center',
          justifyContent: 'center',
        }}
      >
        <Ionicons name={icon} size={20} color={colors.brandOrange} />
      </View>
      <Text
        style={{
          flex: 1,
          fontFamily: 'Nunito_600SemiBold',
          fontSize: 15,
          lineHeight: 21,
          color: colors.text,
        }}
      >
        {text}
      </Text>
    </View>
  );
}
