package com.neusoft.smart.pos.dto.order.response;

import com.neusoft.smart.pos.dto.order.request.DeliveryInfo;
import com.neusoft.smart.pos.dto.order.request.VariableFee;
import com.neusoft.smart.pos.framework.utils.DateUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author tongmg
 * @date 2019-12-10 10：43
 * @description 订单查询使用Response
 */
@ApiModel
@Data
@NoArgsConstructor
public class GetAllOrderInfoResponse implements Serializable {
    private static final long serialVersionUID = 1L;

    private Integer id;
    private String orderNumber;
    private Integer orgId;
    private Integer shopId;
    private String orgName;
    private String shopName;
    private String buyerId;
    private String serialNo;
    private String deviceName;
    private String customerNumber;
    private Integer seqNo;
    private Long orderAmount;
    private Long realPayAmount;
    private String orderStatus;
    private String orderType;
    private String locationNo;
    private String couponNo;
    private Date timeExpire;
    private Integer version;
    private String printerFlag;
    private String remark;
    private Date createdAt;
    private String createdBy;
    private String updatedBy;
    private Date updatedAt;
    private Long orderAmountLong;
    private Long discountAmount;
    private Long hasPay;

    private List<OrderDetail> orderDetailList;
    private List<PayInfo> payInfos;
    private List<OrderRefundInfo> orderRefunds;
    private String orderSubType;

    private DeliveryInfo deliveryInfo;

    private List<VariableFee> variableFees;

    @Data
    @ApiModel
    public static class OrderDetail implements Serializable {
        private Integer id;
        private String orderNumber;
        private String itemNumber;
        private String itemName;
        private String categoryName;
        private String categoryNumber;
        private BigDecimal unitPrice;
        private BigDecimal discountAmount;
        private BigDecimal quantity;
        private BigDecimal finalPrice;
        private Integer version;
        private Date createdAt;
        private String createdBy;
        private String updatedBy;
        private Date updatedAt;
        private String image;
    }

    @Data
    @ApiModel
    public static class PayInfo implements Serializable {
        private Integer id;
        private String tradeId;
        private String payType;
        private String payTypeName;
        private Long payAmount;
        private Long refundedAmount;
        private String payStatus;
        private String payStatusName;
        private String retrvlRefNo;
        private String oriTraceNo;
        private String oriBatchNo;
        private String transDate;

        private String requestDetailInfo;
        private String responseDetailInfo;
        private String payTime;
        private Date createdAt;
        private String outerOrderNumber;
        public void setPayTime(Date payTime) {this.payTime = DateUtils.format(payTime,DateUtils.FORMAT_LONG);}
    }

    @Data
    @ApiModel
    public static class OrderRefundInfo implements Serializable {
        private Integer id;
        private String refundNumber;
        private String originalOrderNumber;
        private Long refundableAmount;
        private String refundStatus;
        private Long refundedAmount;
        private String refundedTime;
        public void setRefundedTime(Date refundedTime) {this.refundedTime = DateUtils.format(refundedTime,DateUtils.FORMAT_LONG);}

        private List<PayRefundOrderInfo> payRefundOrderInfos;

    }

    @Data
    @ApiModel
    public static class PayRefundOrderInfo implements Serializable {
        private Integer id;
        private String refundNumber;
        private String mOrderNumber;
        private String tradeId;
        private String payRefundOrderNumber;
        private String thirdRefundNumber;
        private String payType;
        private Long refundedAmount;
        private String refundStatus;
        private Date createdAt;
        private String refundedTime;
        public void setRefundedTime(Date refundedTime) {this.refundedTime = DateUtils.format(refundedTime,DateUtils.FORMAT_LONG);}
    }
}
