package com.fs.erp.dto.sdk.wangdianTwo.api.dto;

import com.google.gson.annotations.SerializedName;

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


/**
 * 退款单同步接口请求参数实体类
 */
public class RawRefundUpload2Request {

    /**
     * 店铺编号
     */
    @SerializedName("shop_no")
    private String shopNo;

    /**
     * 原始退款单实体类
     */
    private List<RefundOrder> orderList;


    // Getters and Setters
    public String getShopNo() {
        return shopNo;
    }

    public void setShopNo(String shopNo) {
        this.shopNo = shopNo;
    }

    public List<RefundOrder> getOrderList() {
        return orderList;
    }

    public void setOrderList(List<RefundOrder> refundOrder) {
        this.orderList = refundOrder;
    }

    /**
     * 原始退款单实体类
     */
    public static class RefundOrder {

        /**
         * 原始退款单号
         */
        @SerializedName("refund_no")
        private String refundNo;

        /**
         * 货品数量
         */
        @SerializedName("num")
        private BigDecimal num;

        /**
         * 原始单号
         */
        @SerializedName("tid")
        private String tid;

        /**
         * 原始子单号
         */
        @SerializedName("oid")
        private String oid;

        /**
         * 退款单类型
         * 0取消订单 1退款(未发货，退款申请) 2退货 3换货 4退款不退货
         * 当type=3时原始退款单递交不会生成系统退货单
         */
        @SerializedName("type")
        private Integer type;

        /**
         * 平台状态
         * 1取消退款,2已申请退款,3等待退货,4等待收货,5退款成功
         */
        @SerializedName("status")
        private Integer status;

        /**
         * 退款版本，默认传1即可
         */
        @SerializedName("refund_version")
        private String refundVersion;

        /**
         * 申请退款金额
         */
        @SerializedName("refund_amount")
        private BigDecimal refundAmount;

        /**
         * 实际退款金额
         */
        @SerializedName("actual_refund_amount")
        private BigDecimal actualRefundAmount;

        /**
         * 标题，对应原始退款单页面主单货品字段，若无传空字符串
         */
        @SerializedName("title")
        private String title;

        /**
         * 物流公司名称（支持自定义推送），若无传空字符串
         */
        @SerializedName("logistics_name")
        private String logisticsName;

        /**
         * 物流单号，若无传空字符串
         */
        @SerializedName("logistics_no")
        private String logisticsNo;

        /**
         * 客户网名
         */
        @SerializedName("buyer_nick")
        private String buyerNick;

        /**
         * 退款创建时间
         */
        @SerializedName("refund_time")
        private String refundTime;

        /**
         * 退款成功时间
         */
        @SerializedName("current_phase_timeout")
        private String currentPhaseTimeout;

        /**
         * 是否售后退款单
         * 0：否 1：是
         */
        @SerializedName("is_aftersale")
        private Integer isAftersale;

        /**
         * 退款原因
         */
        @SerializedName("reason")
        private String reason;

        /**
         * 单价
         */
        @SerializedName("price")
        private BigDecimal price;

        /**
         * 买家支付帐号
         */
        @SerializedName("pay_account")
        private String payAccount;

        /**
         * 支付订单号
         */
        @SerializedName("pay_no")
        private String payNo;

        /**
         * 备注
         */
        @SerializedName("remark")
        private String remark;

        /**
         * 退款货品总价
         */
        @SerializedName("total_amount")
        private BigDecimal totalAmount;

        /**
         * 平台规格编号
         */
        @SerializedName("spec_no")
        private String specNo;

        /**
         * 平台规格id
         */
        @SerializedName("spec_id")
        private String specId;

        /**
         * 平台货品编号
         */
        @SerializedName("goods_no")
        private String goodsNo;

        /**
         * 平台货品id
         */
        @SerializedName("goods_id")
        private String goodsId;

        /**
         * 修改掩码
         * 1:新订单 2:状态变化 4:金额变化
         */
        @SerializedName("modify_flag")
        private Integer modifyFlag;

        // Getters and Setters
        public String getRefundNo() {
            return refundNo;
        }

        public void setRefundNo(String refundNo) {
            this.refundNo = refundNo;
        }

        public BigDecimal getNum() {
            return num;
        }

        public void setNum(BigDecimal num) {
            this.num = num;
        }

        public String getTid() {
            return tid;
        }

        public void setTid(String tid) {
            this.tid = tid;
        }

        public String getOid() {
            return oid;
        }

        public void setOid(String oid) {
            this.oid = oid;
        }

        public Integer getType() {
            return type;
        }

        public void setType(Integer type) {
            this.type = type;
        }

        public Integer getStatus() {
            return status;
        }

        public void setStatus(Integer status) {
            this.status = status;
        }

        public String getRefundVersion() {
            return refundVersion;
        }

        public void setRefundVersion(String refundVersion) {
            this.refundVersion = refundVersion;
        }

        public BigDecimal getRefundAmount() {
            return refundAmount;
        }

        public void setRefundAmount(BigDecimal refundAmount) {
            this.refundAmount = refundAmount;
        }

        public BigDecimal getActualRefundAmount() {
            return actualRefundAmount;
        }

        public void setActualRefundAmount(BigDecimal actualRefundAmount) {
            this.actualRefundAmount = actualRefundAmount;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getLogisticsName() {
            return logisticsName;
        }

        public void setLogisticsName(String logisticsName) {
            this.logisticsName = logisticsName;
        }

        public String getLogisticsNo() {
            return logisticsNo;
        }

        public void setLogisticsNo(String logisticsNo) {
            this.logisticsNo = logisticsNo;
        }

        public String getBuyerNick() {
            return buyerNick;
        }

        public void setBuyerNick(String buyerNick) {
            this.buyerNick = buyerNick;
        }

        public String getRefundTime() {
            return refundTime;
        }

        public void setRefundTime(String refundTime) {
            this.refundTime = refundTime;
        }

        public String getCurrentPhaseTimeout() {
            return currentPhaseTimeout;
        }

        public void setCurrentPhaseTimeout(String currentPhaseTimeout) {
            this.currentPhaseTimeout = currentPhaseTimeout;
        }

        public Integer getIsAftersale() {
            return isAftersale;
        }

        public void setIsAftersale(Integer isAftersale) {
            this.isAftersale = isAftersale;
        }

        public String getReason() {
            return reason;
        }

        public void setReason(String reason) {
            this.reason = reason;
        }

        public BigDecimal getPrice() {
            return price;
        }

        public void setPrice(BigDecimal price) {
            this.price = price;
        }

        public String getPayAccount() {
            return payAccount;
        }

        public void setPayAccount(String payAccount) {
            this.payAccount = payAccount;
        }

        public String getPayNo() {
            return payNo;
        }

        public void setPayNo(String payNo) {
            this.payNo = payNo;
        }

        public String getRemark() {
            return remark;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }

        public BigDecimal getTotalAmount() {
            return totalAmount;
        }

        public void setTotalAmount(BigDecimal totalAmount) {
            this.totalAmount = totalAmount;
        }

        public String getSpecNo() {
            return specNo;
        }

        public void setSpecNo(String specNo) {
            this.specNo = specNo;
        }

        public String getSpecId() {
            return specId;
        }

        public void setSpecId(String specId) {
            this.specId = specId;
        }

        public String getGoodsNo() {
            return goodsNo;
        }

        public void setGoodsNo(String goodsNo) {
            this.goodsNo = goodsNo;
        }

        public String getGoodsId() {
            return goodsId;
        }

        public void setGoodsId(String goodsId) {
            this.goodsId = goodsId;
        }

        public Integer getModifyFlag() {
            return modifyFlag;
        }

        public void setModifyFlag(Integer modifyFlag) {
            this.modifyFlag = modifyFlag;
        }
    }

    /**
     * 退款单类型枚举
     */
    public enum RefundType {
        CANCEL_ORDER(0, "取消订单"),
        REFUND_BEFORE_SHIP(1, "退款(未发货，退款申请)"),
        RETURN_GOODS(2, "退货"),
        EXCHANGE_GOODS(3, "换货"),
        REFUND_WITHOUT_RETURN(4, "退款不退货");

        private final Integer code;
        private final String desc;

        RefundType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public Integer getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }
    }

    /**
     * 退款单状态枚举
     */
    public enum RefundStatus {
        CANCEL_REFUND(1, "取消退款"),
        APPLY_REFUND(2, "已申请退款"),
        WAIT_RETURN(3, "等待退货"),
        WAIT_RECEIVE(4, "等待收货"),
        REFUND_SUCCESS(5, "退款成功");

        private final Integer code;
        private final String desc;

        RefundStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public Integer getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }
    }

    /**
     * 是否售后退款单枚举
     */
    public enum IsAftersale {
        NO(0, "否"),
        YES(1, "是");

        private final Integer code;
        private final String desc;

        IsAftersale(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public Integer getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }
    }

    /**
     * 修改掩码枚举
     */
    public enum ModifyFlag {
        NEW_ORDER(1, "新订单"),
        STATUS_CHANGE(2, "状态变化"),
        AMOUNT_CHANGE(4, "金额变化");

        private final Integer code;
        private final String desc;

        ModifyFlag(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public Integer getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }

        /**
         * 组合修改掩码（使用位运算）
         */
        public static Integer combine(ModifyFlag... flags) {
            if (flags == null || flags.length == 0) {
                return 0;
            }

            int result = 0;
            for (ModifyFlag flag : flags) {
                result |= flag.getCode();
            }
            return result;
        }
    }

}
