package com.erp.tenant.dto.order;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.List;

/**
 * 订单详情响应DTO
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OrderDetailResponse {

    private OrderDTO order;

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class OrderDTO {
        private Long id;
        private String orderSn;
        private String platformOrderSn;
        private String platform;
        private String shopName;
        private String erpStatus;
        private String erpStatusText;
        private String orderStatus;
        private String deliveryStatus;
        private String receiverName;
        private String receiverPhone;
        private String receiverProvince;
        private String receiverCity;
        private String receiverDistrict;
        private String receiverAddress;
        private Long warehouseId;
        private String warehouseName;
        private String logisticsCompany;
        private String logisticsNo;
        private BigDecimal totalAmount;
        private BigDecimal goodsAmount;
        private BigDecimal freight;
        private BigDecimal discountAmount;
        private String paymentTime;
        private String shippedAt;
        private String approvedAt;
        private String rejectedAt;
        private String rejectReason;
        private String remark;
        private String adminRemark;
        private String createdAt;
        private String updatedAt;
        private List<OrderItemDTO> items;
        private List<FreezeRecordDTO> freezeRecords;
        private List<OrderLogDTO> logs;
        private List<TrackingDTO> tracking;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class OrderItemDTO {
        private Long id;
        private String skuCode;
        private String goodsName;
        private String spec;
        private Integer quantity;
        private BigDecimal price;
        private BigDecimal subtotal;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class FreezeRecordDTO {
        private Long id;
        private String skuCode;
        private Integer quantity;
        private String status;
        private String createdAt;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class OrderLogDTO {
        private String action;
        private String operator;
        private String content;
        private String createdAt;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class TrackingDTO {
        private String time;
        private String status;
        private String location;
        private String description;
    }
}
