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

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps;
import org.springframework.util.StringUtils;

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

/**
 * 履约模型 --自提
 * @Author chang.n
 * @ClassName Performance
 * @Date 2020/4/14 11:35 AM
 */
public class PerformanceSelfTake {


    /**
     * 主键
     */
    private Long id;

    /**
     * 业务类型
     */
    private Integer bizType;

    /**
     * 订单号
     */
    private String orderNo;

    /**
     * 商家id
     */
    private Long sellerId;

    /**
     * 门店id
     */
    private Long storeId;

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

    /**
     * 提货人姓名
     */
    private String selfTakeName;

    /**
     * 提货人手机
     */
    private String selfTakeMobile;

    /**
     * 自提code码
     */
    private Long selfTakeCode;

    /**
     * 提货码图片url
     */
    private String codeUrl;

    /**
     * 提货条形码图片url
     */
    private String barCodeUrl;

    /**
     * 核销类型（1：买家随时自提 2: 买家选择自提时间 3: 卖家设置自提时间）
     */
    private Integer verifyType;

    /**
     * 0：随时 1:指定时间段（self_take_start_at + self_take_end_at）
     */
    private Integer appointedDateType;

    /**
     * 预约核销开始时间
     */
    private Date selfTakeStartAt;

    /**
     * 预约核销结束时间
     */
    private Date selfTakeEndAt;

    /**
     * 核销时间
     */
    private Date pickAt;

    /**
     * 自动核销时间
     */
    private Date autoVerifyAt;

    /**
     * 提货状态 0-未提货 1-已提货 2-异常
     */
    private Integer selfTakeStatus;

    /**
     * 异常原因
     */
    private String unusualReason;

    /**
     * 备注
     */
    private String remark;

    /**
     * 扩展信息
     */
    private String features;

    /**
     * 创建时间
     */
    private Date createdAt;

    /**
     * 修改时间
     */
    private Date updatedAt;

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

    /**
     * 删除标识
     */
    private Integer isDeleted;

    public Integer getBizType() {
        return bizType;
    }

    public void setBizType(Integer bizType) {
        this.bizType = bizType;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Integer getAppointedDateType() {
        return appointedDateType;
    }

    public void setAppointedDateType(Integer appointedDateType) {
        this.appointedDateType = appointedDateType;
    }

    public String getSelfTakeName() {
        return selfTakeName;
    }

    public void setSelfTakeName(String selfTakeName) {
        this.selfTakeName = selfTakeName;
    }

    public String getSelfTakeMobile() {
        return selfTakeMobile;
    }

    public void setSelfTakeMobile(String selfTakeMobile) {
        this.selfTakeMobile = selfTakeMobile;
    }

    public Date getAutoVerifyAt() {
        return autoVerifyAt;
    }

    public void setAutoVerifyAt(Date autoVerifyAt) {
        this.autoVerifyAt = autoVerifyAt;
    }

    public Long getId() {
        return id;
    }

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

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public Long getStoreId() {
        return storeId;
    }

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

    public Long getUserId() {
        return userId;
    }

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

    public Long getSelfTakeCode() {
        return selfTakeCode;
    }

    public void setSelfTakeCode(Long selfTakeCode) {
        this.selfTakeCode = selfTakeCode;
    }

    public String getCodeUrl() {
        return codeUrl;
    }

    public void setCodeUrl(String codeUrl) {
        this.codeUrl = codeUrl;
    }

    public String getBarCodeUrl() {
        return barCodeUrl;
    }

    public void setBarCodeUrl(String barCodeUrl) {
        this.barCodeUrl = barCodeUrl;
    }


    public Date getSelfTakeStartAt() {
        return selfTakeStartAt;
    }

    public void setSelfTakeStartAt(Date selfTakeStartAt) {
        this.selfTakeStartAt = selfTakeStartAt;
    }

    public Date getSelfTakeEndAt() {
        return selfTakeEndAt;
    }

    public void setSelfTakeEndAt(Date selfTakeEndAt) {
        this.selfTakeEndAt = selfTakeEndAt;
    }

    public Date getPickAt() {
        return pickAt;
    }

    public void setPickAt(Date pickAt) {
        this.pickAt = pickAt;
    }

    public Integer getVerifyType() {
        return verifyType;
    }

    public void setVerifyType(Integer verifyType) {
        this.verifyType = verifyType;
    }

    public Integer getSelfTakeStatus() {
        return selfTakeStatus;
    }

    public void setSelfTakeStatus(Integer selfTakeStatus) {
        this.selfTakeStatus = selfTakeStatus;
    }

    public String getUnusualReason() {
        return unusualReason;
    }

    public void setUnusualReason(String unusualReason) {
        this.unusualReason = unusualReason;
    }

    public String getRemark() {
        return remark;
    }

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

    public String getFeatures() {
        return features;
    }

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

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Long getSellerId() {
        return sellerId;
    }

    public void setSellerId(Long sellerId) {
        this.sellerId = sellerId;
    }

    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;
    }

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