import React from 'react';
import { View, Text } from 'react-native';
import { useLocalSearchParams } from 'expo-router';
import { PageContainer } from '@/components/ui/PageContainer';
import { NavLink } from '@/components/ui/NavLink';
import { useLanguage } from '@/i18n/LanguageContext';
import { useTheme } from '@/constants/ThemeContext';
import { Bus, User } from 'lucide-react-native';

export default function TripDetailsScreen() {
  const { id } = useLocalSearchParams<{ id: string }>();
  const { t } = useLanguage();
  const { isDark } = useTheme();

  return (
    <PageContainer
      filePath="app/trips/[id].tsx"
      title={`${t('tripDetails')} (${id || 'trip-101'})`}
      subtitle="Yaoundé Gare Mvan ➔ Douala Gare Mvan"
    >
      <View
        className={`p-5 rounded-3xl border mb-4 ${
          isDark ? 'bg-slate-900 border-slate-800' : 'bg-white border-slate-200'
        }`}
      >
        <View className="flex-row items-center mb-3 space-x-2">
          <View className="bg-sky-500/20 p-2.5 rounded-xl">
            <Bus size={22} color="#38BDF8" />
          </View>
          <Text className={`font-black text-lg ${isDark ? 'text-white' : 'text-[#0B1F4D]'}`}>
            General Express VIP
          </Text>
        </View>

        <Text className={`text-sm ${isDark ? 'text-slate-300' : 'text-slate-700'}`}>
          • {t('departure')}: 07:30 AM (Yaoundé)
        </Text>
        <Text className={`text-sm mt-1 ${isDark ? 'text-slate-300' : 'text-slate-700'}`}>
          • {t('arrival')}: 11:30 AM (Douala)
        </Text>
        <Text className={`text-sm mt-1 ${isDark ? 'text-slate-300' : 'text-slate-700'}`}>
          • Amenities: Aircon, On-board Smart Cam, Wi-Fi, Luggage Space
        </Text>

        <Text className={`text-xl font-black mt-3 ${isDark ? 'text-sky-400' : 'text-[#0284C7]'}`}>
          {t('price')}: 5,000 XAF
        </Text>
      </View>

      <NavLink
        href={{
          pathname: '/trips/select-seat',
          params: { tripId: id || 'trip-101' },
        }}
        label={t('selectSeat')}
        description="Choose your preferred bus seat"
        variant="primary"
        icon={<User size={20} color="#FFFFFF" />}
      />

      <NavLink
        href="/search/results"
        label={`${t('back')} to Results`}
        description="View other bus options"
        variant="outline"
        icon={<Bus size={20} color={isDark ? '#38BDF8' : '#0284C7'} />}
      />
    </PageContainer>
  );
}
