import {
    View,
    Text,
    Pressable,
    Image,
    ScrollView,
    Alert,
    ImageBackground,
    ActivityIndicator,
    Dimensions
} from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { router, useLocalSearchParams } from 'expo-router';
import { CrossLogoSvg, PreviousPageBlackSvg } from '../../../../component/global/SVG';
import { useEffect, useState } from 'react';

import DisplayedOnlyCouponTabView from '../../../../component/global/displayedOnlyCouponTabView';
import NotificationTabView from '../../../../component/global/notificationTabViewComponent';
import { chargeStationService } from '../../../../service/chargeStationService';
import { formatToChineseDateTime } from '../../../../util/lib';
const ChargingDetailPage = () => {
    const screenHeight = Dimensions.get('window').height;
    const { promotion } = useLocalSearchParams();
    const promotionObj = JSON.parse(promotion as string);
    const [loading, setLoading] = useState(false);


   
    return (
        <SafeAreaView className="flex-1 bg-white" edges={['top', 'right', 'left']}>
            <ScrollView>
                {loading ? (
                    <View className="items-center justify-center">
                        <ActivityIndicator />
                    </View>
                ) : (
                    <View style={{ minHeight: screenHeight, flex: 1 }} className="mx-[5%]">
                        <View style={{ marginTop: 25 }}>
                            <Pressable
                                onPress={() => {
                                    if (router.canGoBack()) {
                                        router.back();
                                    } else {
                                        router.replace('/notificationPage');
                                    }
                                }}
                                hitSlop={{ top: 20, bottom: 20, left: 20, right: 20 }}
                            >
                                <CrossLogoSvg />
                            </Pressable>
                            <Text style={{ fontSize: 45, marginVertical: 25 }}>詳情</Text>
                        </View>
                        <View className="space-y-2 ">
                            <Text className="text-base lg:text-lg">充電完成</Text>
                            <Text className="text-sm">親愛的用戶，您的愛車已充滿電完成！請盡快駛離充電站，以便其他車輛使用。感謝您的配合！</Text>
                            <Text className="text-xs text-gray-500 pt-8 pb-4">
                                最新更新日期:{formatToChineseDateTime(promotionObj.updatedAt)}
                            </Text>
                        </View>
                    </View>
                )}
            </ScrollView>
        </SafeAreaView>
    );
};

export default ChargingDetailPage;