package com.ruoyi.app.flashdelivery.dto;

import org.junit.jupiter.api.Test;

import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

class FlashDeliveryOrderViewTest {
    @Test
    void roleBusinessViewExcludesPersistenceAndIdentityInternals() {
        Set<String> fields = Stream.of(FlashDeliveryOrderView.class.getDeclaredFields())
                .map(java.lang.reflect.Field::getName).collect(Collectors.toSet());
        for (String forbidden : Set.of("userId", "clientRequestId", "deliveryPinCode",
                "pricingVersion", "cancelOperatorId", "cancelOperatorType", "version")) {
            assertFalse(fields.contains(forbidden), forbidden);
        }
        for (String required : Set.of("serviceType", "deliveryType", "packageType", "quantity",
                "totalWeightKg", "specification", "packageSize", "deliveryMode",
                "scheduledPickupStartAt", "pinRequired", "pickup", "delivery",
                "baseDeliveryFee", "distanceFee", "urgentFee", "tipAmount", "amount")) {
            assertTrue(fields.contains(required), required);
        }
    }

    @Test
    void appDetailIsDirectOrderDataWithExplicitImageArrays() {
        Set<String> fields = Stream.of(FlashDeliveryOrderDetailView.class.getDeclaredFields())
                .map(java.lang.reflect.Field::getName).collect(Collectors.toSet());
        for (String forbidden : Set.of("order", "images", "logs")) {
            assertFalse(fields.contains(forbidden), forbidden);
        }
        for (String required : Set.of("senderImageUrls", "pickupImageUrls",
                "deliveryImageUrls", "rider", "deliveryPinCode")) {
            assertTrue(fields.contains(required), required);
        }
        assertTrue(FlashDeliveryOrderView.class.isAssignableFrom(FlashDeliveryOrderDetailView.class));
    }
}
