import React from 'react';
import { View, Text } from 'react-native';
import { useNavigation, useRoute, RouteProp } from '@react-navigation/native';
import { StackNavigationProp } from '@react-navigation/stack';
import { getStyles } from './orderConfirmedScreen.styles';
import { Header, PrimaryButton } from '@components';
import { useAppTheme } from '@theme';
import { AppStackParamList } from '../../../navigation/appStack';

type OrderConfirmedNavProp = StackNavigationProp<AppStackParamList, 'OrderConfirmedScreen'>;
type OrderConfirmedRouteProp = RouteProp<AppStackParamList, 'OrderConfirmedScreen'>;

export const OrderConfirmedScreen: React.FC = () => {
  const { colors } = useAppTheme();
  const styles = getStyles(colors);
  const navigation = useNavigation<OrderConfirmedNavProp>();
  const route = useRoute<OrderConfirmedRouteProp>();
  const orderId = route.params?.orderId || 'ORD-123456';

  return (
    <View style={styles.container}>
      <Header title="Order Confirmed" onBack={() => navigation.navigate('MainTabs')} />
      <View style={styles.content}>
        <Text style={styles.icon}>✅</Text>
        <Text style={styles.title}>Order Confirmed!</Text>
        <Text style={styles.subtitle}>
          Your order has been placed successfully
        </Text>
        <View style={styles.orderCard}>
          <Text style={styles.orderId}>Order ID: {orderId}</Text>
          <Text style={styles.orderEta}>Estimated delivery: 25-30 min</Text>
        </View>
      </View>
      <View style={styles.footer}>
        <PrimaryButton title="Done" onPress={() => navigation.replace('MainTabs')} />
      </View>
    </View>
  );
};
