package com.wzj.soopin.order.domain.bo;

import com.wzj.soopin.order.domain.entity.Order;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dromara.common.excel.annotation.Excel;

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

/**
 * 退款请求
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RefundBO {
    /**
     * 订单ID
     */
    @NotNull(message = "订单ID不能为空")
    private Long orderId;

    /**
     * 退款项
     */
    @NotNull(message = "退款项不能为空")
    @Valid
    private List<RefundItemBO> refundItemBoList;

    /**
     * 退款原因
     */
    private String refundReason;

    /**
     * 订单信息
     */
    @Schema(description = "订单信息", hidden = true)
    private Order order;

    /**
     * 退款总金额
     */
    @Schema(description = "退款总金额", hidden = true)
    private BigDecimal totalRefundAmount;

    @Schema(description = "退款流水号", hidden = true)
    private String orgTrace;


    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Builder
    public static class RefundItemBO {

        /**
         * 订单子项ID
         */
        @NotNull(message = "订单子项ID不能为空")
        private Long orderItemId;

        /**
         * 退款金额，单位：元
         */
        @NotNull(message = "退款金额不能为空")
        private BigDecimal refundAmount;

        /**
         * 退货数量
         */
        @NotNull(message = "退货数量不能为空")
        private Integer quantity;
    }
}
