package com.zm.order.tool.server.model;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.util.StringUtils;

import java.util.Date;
import java.util.Map;
import java.util.Objects;

/**
 *
 * @author zhuxiaofeng
 * @date 2021/8/12 15:18
 */
public class BusinessOrderUpdateModelRequest {
    /**
     * ID
     */
    private Long id;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 状态
     */
    private Integer status;

    /**
     * 支付状态
     */
    private Integer payStatus;

    /**
     * 支付类型
     */
    private Integer payType;

    /**
     * 支付类型
     */
    private Integer orderType;
    /**
     * 支付类型
     */
    private Integer orderSubType;

    public Integer getOrderSubType() {
        return orderSubType;
    }

    public void setOrderSubType(Integer orderSubType) {
        this.orderSubType = orderSubType;
    }

    public Integer getOrderType() {
        return orderType;
    }

    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }

    /**
     * 支付人
     */
    private Long payer;

    /**
     * 支付单号
     */
    private String payNo;

    /**
     * 三方支付单号
     */
    private String thirdPayNo;

    /**
     * 支付信息
     */
    private String payInfo;

    /**
     * 支付快照
     */
    private String payDetailInfo;

    /**
     * 支付时间
     */
    private Date payAt;

    private Date completedAt;

    /**
     * 扩展信息
     */
    private Map<String, Object> extraMap;

    /**
     * 履约类型
     */
    private Integer performanceType;

    /**
     * 履约状态
     */
    private Integer performanceStatus;
    private String features;
    private String featuresCipher;

    public String getFeaturesCipher() {
        return featuresCipher;
    }

    public void setFeaturesCipher(String featuresCipher) {
        this.featuresCipher = featuresCipher;
    }

    private String buyerRemarks;

    @ApiModelProperty(value = "门店id")
    private Long storeId;

    @ApiModelProperty(value = "总金额 单位分")
    private Integer totalAmount;

    @ApiModelProperty(value = "packAmount 单位分")
    private Integer packAmount;

    @ApiModelProperty(value = "itemAmount 单位分")
    private Integer itemAmount;

    @ApiModelProperty(value = "freightAmount 单位分")
    private Integer freightAmount;

    @ApiModelProperty(value = "actualAmount 单位分")
    private Integer actualAmount;

    @ApiModelProperty(value = "discountAmount 单位分")
    private Integer discountAmount;

    @ApiModelProperty(value = "payAmount 单位分")
    private Integer payAmount;

    @ApiModelProperty(value = "取单号")
    private String storeOrderNo;

    private String sellerRemarks;

    public String getSellerRemarks() {
        return sellerRemarks;
    }

    public void setSellerRemarks(String sellerRemarks) {
        this.sellerRemarks = sellerRemarks;
    }

    public String getStoreOrderNo() {
        return storeOrderNo;
    }

    public void setStoreOrderNo(String storeOrderNo) {
        this.storeOrderNo = storeOrderNo;
    }

    public String getFeatures() {
        return features;
    }

    public void setFeatures(String features) {
        this.features = features;
    }

    public Long getStoreId() {
        return storeId;
    }

    public void setStoreId(Long storeId) {
        this.storeId = storeId;
    }

    public Integer getTotalAmount() {
        return totalAmount;
    }

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

    public Integer getPackAmount() {
        return packAmount;
    }

    public void setPackAmount(Integer packAmount) {
        this.packAmount = packAmount;
    }

    public Integer getItemAmount() {
        return itemAmount;
    }

    public void setItemAmount(Integer itemAmount) {
        this.itemAmount = itemAmount;
    }

    public Integer getFreightAmount() {
        return freightAmount;
    }

    public void setFreightAmount(Integer freightAmount) {
        this.freightAmount = freightAmount;
    }

    public Integer getActualAmount() {
        return actualAmount;
    }

    public void setActualAmount(Integer actualAmount) {
        this.actualAmount = actualAmount;
    }

    public Integer getDiscountAmount() {
        return discountAmount;
    }

    public void setDiscountAmount(Integer discountAmount) {
        this.discountAmount = discountAmount;
    }

    public Integer getPayAmount() {
        return payAmount;
    }

    public void setPayAmount(Integer payAmount) {
        this.payAmount = payAmount;
    }

    public String getBuyerRemarks() {
        return buyerRemarks;
    }

    public void setBuyerRemarks(String buyerRemarks) {
        this.buyerRemarks = buyerRemarks;
    }

    public Map<String, Object> getExtraMap() {
        if (!StringUtils.isEmpty(features)) {
            Map<String, Object> extra = JSON.parseObject(features, Map.class);
            return extra;
        }
        if (extraMap == null) {
            return Maps.newHashMap();
        }
        return extraMap;
    }

    public void setExtraMap(Map<String, Object> extraMap) {
        if (Objects.nonNull(extraMap) && !extraMap.isEmpty()) {
            this.features = JSON.toJSONString(extraMap);
        }
        this.extraMap = extraMap;
    }

    public Integer getPerformanceType() {
        return performanceType;
    }

    public void setPerformanceType(Integer performanceType) {
        this.performanceType = performanceType;
    }

    public Integer getPerformanceStatus() {
        return performanceStatus;
    }

    public void setPerformanceStatus(Integer performanceStatus) {
        this.performanceStatus = performanceStatus;
    }

    public Date getCompletedAt() {
        return completedAt;
    }

    public void setCompletedAt(Date completedAt) {
        this.completedAt = completedAt;
    }

    public String getPayDetailInfo() {
        return payDetailInfo;
    }

    public void setPayDetailInfo(String payDetailInfo) {
        this.payDetailInfo = payDetailInfo;
    }

    public Integer getPayType() {
        return payType;
    }

    public void setPayType(Integer payType) {
        this.payType = payType;
    }

    public Long getPayer() {
        return payer;
    }

    public void setPayer(Long payer) {
        this.payer = payer;
    }

    public String getPayNo() {
        return payNo;
    }

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

    public String getThirdPayNo() {
        return thirdPayNo;
    }

    public void setThirdPayNo(String thirdPayNo) {
        this.thirdPayNo = thirdPayNo;
    }

    public String getPayInfo() {
        return payInfo;
    }

    public void setPayInfo(String payInfo) {
        this.payInfo = payInfo;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Integer getStatus() {
        return status;
    }

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

    public Integer getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(Integer payStatus) {
        this.payStatus = payStatus;
    }

    public Date getPayAt() {
        return payAt;
    }

    public void setPayAt(Date payAt) {
        this.payAt = payAt;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}
