import React from 'react';
import { View, Text } from 'react-native';
import { useAppTheme } from '@theme';
import { PrimaryButton } from '@components';
import { useAppSelector } from '@store';
import { useNavigation } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { AppStackParamList } from '@navigation/navigationTypes';
import { RouteNames } from '@utils/constants';
import { getStyles } from './arrivedAtCustomerScreen.styles';

export const ArrivedAtCustomerScreen: React.FC = () => {
  const { colors } = useAppTheme();
  const styles = getStyles(colors);
  const navigation =
    useNavigation<NativeStackNavigationProp<AppStackParamList>>();

  const activeJob = useAppSelector(state => state.job.activeJob);

  const handleConfirmArrival = () => {
    // navigation.navigate(RouteNames.DeliverOrder);
  };

  // if (!activeJob) return null;

  return (
    <View style={styles.container}>
      {/* Map Background Placeholder */}
      <View style={styles.mapPlaceholder}>
        <Text style={styles.placeholderText}>[ Map Placeholder ]</Text>
      </View>

      {/* Arrived Card */}
      <View style={styles.bottomCard}>
        <Text style={styles.cardTitle}>You've arrived</Text>
        <Text style={styles.customerName}>{activeJob?.dropName}</Text>
        <Text style={styles.customerAddress}>{activeJob?.dropAddress}</Text>

        <PrimaryButton
          title="Confirm Arrival"
          onPress={handleConfirmArrival}
          style={styles.arrivedButton}
        />
      </View>
    </View>
  );
};

export default ArrivedAtCustomerScreen;
