package com.qmth.sop.business.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.sop.common.contant.SystemConstant;
import com.qmth.sop.common.enums.DelayWarnTypeEnum;
import com.qmth.sop.common.enums.FlowApprovePassEnum;
import com.qmth.sop.common.enums.ProjectExchangeApproveEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 项目变更计划表
 * </p>
 *
 * @author wangliang
 * @since 2023-08-01
 */
@ApiModel(value = "TBProjectExchange对象", description = "项目变更计划表")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TBProjectExchange implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @ApiModelProperty(value = "sop单号")
    @NotBlank(message = "sop单号不能为空")
    private String sopNo;

    @ApiModelProperty(value = "crm单号")
    @NotBlank(message = "crm单号不能为空")
    private String crmNo;

    @ApiModelProperty(value = "变更编号")
    private String exchangeNo;

    @ApiModelProperty(value = "服务单元id")
    @JsonSerialize(using = ToStringSerializer.class)
    @NotNull(message = "服务单元id不能为空")
    private Long serviceId;

    @ApiModelProperty(value = "变更类型，PLAN：项目信息及计划，CANCEL：项目取消")
    @NotNull(message = "变更类型不能为空")
    private DelayWarnTypeEnum type;

    @ApiModelProperty(value = "变更原因")
    @NotBlank(message = "变更原因不能为空")
    private String reason;

    @ApiModelProperty(value = "变更内容json")
    private String contentJson;

    @ApiModelProperty(value = "处理结果，FINISH：已完成，NOT_UPDATE：经沟通，取消变更，PARTIAL_UPDATE：经沟通，部分变更")
    private ProjectExchangeApproveEnum result;

    @ApiModelProperty(value = "变更备注")
    private String remark;

    @ApiModelProperty(value = "是否启用，0：停用，1：启用")
    private Boolean enable;

    @ApiModelProperty(value = "创建人id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createId;

    @ApiModelProperty(value = "创建时间")
    private Long createTime;

    @TableField(exist = false)
    @ApiModelProperty(value = "流程部署id")
    @NotBlank(message = "流程部署id不能为空")
    private String flowDeploymentId;

    @ApiModelProperty(value = "流程审批人")
    @TableField(exist = false)
    @JsonSerialize(using = ToStringSerializer.class)
    private List<String> approveUserIds;

    @ApiModelProperty(value = "流程审批")
    @TableField(exist = false)
    @NotNull(message = "流程审批不能为空")
    private FlowApprovePassEnum flowApprove;

    public FlowApprovePassEnum getFlowApprove() {
        return flowApprove;
    }

    public void setFlowApprove(FlowApprovePassEnum flowApprove) {
        this.flowApprove = flowApprove;
    }

    public ProjectExchangeApproveEnum getResult() {
        return result;
    }

    public void setResult(ProjectExchangeApproveEnum result) {
        this.result = result;
    }

    public String getRemark() {
        return remark;
    }

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

    public String getFlowDeploymentId() {
        return flowDeploymentId;
    }

    public void setFlowDeploymentId(String flowDeploymentId) {
        this.flowDeploymentId = flowDeploymentId;
    }

    public List<String> getApproveUserIds() {
        return approveUserIds;
    }

    public void setApproveUserIds(List<String> approveUserIds) {
        this.approveUserIds = approveUserIds;
    }

    public void setCode(String exchangeNo, Long userId) {
        this.exchangeNo = exchangeNo;
        setId(SystemConstant.getDbUuid());
        setCreateId(userId);
        setCreateTime(System.currentTimeMillis());
    }

    public String getExchangeNo() {
        return exchangeNo;
    }

    public void setExchangeNo(String exchangeNo) {
        this.exchangeNo = exchangeNo;
    }

    public Long getId() {
        return id;
    }

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

    public String getSopNo() {
        return sopNo;
    }

    public void setSopNo(String sopNo) {
        this.sopNo = sopNo;
    }

    public String getCrmNo() {
        return crmNo;
    }

    public void setCrmNo(String crmNo) {
        this.crmNo = crmNo;
    }

    public Long getServiceId() {
        return serviceId;
    }

    public void setServiceId(Long serviceId) {
        this.serviceId = serviceId;
    }

    public DelayWarnTypeEnum getType() {
        return type;
    }

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

    public String getReason() {
        return reason;
    }

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

    public String getContentJson() {
        return contentJson;
    }

    public void setContentJson(String contentJson) {
        this.contentJson = contentJson;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public Long getCreateId() {
        return createId;
    }

    public void setCreateId(Long createId) {
        this.createId = createId;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }
}
