package com.erp.logistics.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 物流轨迹响应
 */
@Data
@Builder
@Schema(description = "物流轨迹响应")
public class TraceResponse {

    @Schema(description = "运单号")
    private String waybillNo;

    @Schema(description = "物流商编码")
    private String carrier;

    @Schema(description = "物流商名称")
    private String carrierName;

    @Schema(description = "轨迹列表")
    private List<TraceNode> traces;

    @Schema(description = "当前状态")
    private String status;

    @Schema(description = "状态标签")
    private String statusLabel;

    @Schema(description = "最后更新时间")
    private LocalDateTime lastTraceTime;

    @Schema(description = "轨迹总节点数")
    private Integer totalTraces;

    @Schema(description = "在途天数")
    private Integer transitDays;

    @Schema(description = "途经城市数量")
    private Integer transitCityCount;

    @Schema(description = "预计送达时间（派送中时估算）")
    private LocalDateTime estimatedDelivery;

    @Schema(description = "是否准时（与承诺时间对比）")
    private Boolean isOnTime;

    @Schema(description = "异常标记")
    private String exceptionType;

    @Data
    @Builder
    @Schema(description = "轨迹节点")
    public static class TraceNode {
        @Schema(description = "状态")
        private String status;

        @Schema(description = "状态标签")
        private String statusLabel;

        @Schema(description = "地点")
        private String location;

        @Schema(description = "描述")
        private String description;

        @Schema(description = "轨迹时间")
        private LocalDateTime traceTime;
    }
}
