package com.qmth.sop.business.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.sop.common.base.BaseEntity;
import com.qmth.sop.common.contant.SystemConstant;
import com.qmth.sop.common.enums.FlowApprovePassEnum;
import com.qmth.sop.common.enums.InfluenceDegreeEnum;
import com.qmth.sop.common.enums.QualityProblemReasonEnum;
import com.qmth.sop.common.enums.QualityProblemTypeEnum;
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 = "TBQualityProblemApply对象", description = "质量问题反馈表")
public class TBQualityProblemApply extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

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

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

    @ApiModelProperty(value = "问题单号")
    private String problemNo;

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

    @ApiModelProperty(value = "问题简要")
    private String summary;

    @ApiModelProperty(value = "问题情况说明")
    private String remark;

    @ApiModelProperty(value = "责任人id")
    @JsonSerialize(using = ToStringSerializer.class)
    private String userIds;

    @ApiModelProperty(value = "责任人id数组")
    @TableField(exist = false)
    @JsonSerialize(using = ToStringSerializer.class)
    private List<Long> userIdList;

    @ApiModelProperty(value = "问题类型，UPDATE：修正类，OPTIMIZE：优化类，NO_PROBLEM：不是问题")
    private QualityProblemTypeEnum type;

    @ApiModelProperty(value = "问题原因类型，EXEC：执行类，MANAGER：管理协调类，FLOW：流程制度类，PRODUCT_PROBLEM：产品缺陷类，PRODUCT_MANAGER：产品运维类，OTHER：其它")
    private QualityProblemReasonEnum reason;

    @ApiModelProperty(value = "附件id")
    @JsonSerialize(using = ToStringSerializer.class)
    private String attachmentIds;

    @ApiModelProperty(value = "附件id")
    @TableField(exist = false)
    @JsonSerialize(using = ToStringSerializer.class)
    private List<Long> attachmentIdList;

    @ApiModelProperty(value = "影响度：A，B，C，D")
    @TableField("Influence_degree")
    private InfluenceDegreeEnum influenceDegree;

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

    @TableField(exist = false)
    @ApiModelProperty(value = "流程表单")
    @NotNull(message = "流程表单数据不能为空")
    private String formProperties;

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

    public TBQualityProblemApply() {

    }

    public TBQualityProblemApply(String sopNo, String crmNo, String problemNo, Long serviceId, String summary, String remark, String attachmentIds) {
        setId(SystemConstant.getDbUuid());
        this.sopNo = sopNo;
        this.crmNo = crmNo;
        this.problemNo = problemNo;
        this.serviceId = serviceId;
        this.summary = summary;
        this.remark = remark;
        this.attachmentIds = attachmentIds;
    }

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

    public FlowApprovePassEnum getFlowApprove() {
        return flowApprove;
    }

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

    public List<Long> getUserIdList() {
        return userIdList;
    }

    public void setUserIdList(List<Long> userIdList) {
        this.userIdList = userIdList;
    }

    public List<Long> getAttachmentIdList() {
        return attachmentIdList;
    }

    public void setAttachmentIdList(List<Long> attachmentIdList) {
        this.attachmentIdList = attachmentIdList;
    }

    public String getFormProperties() {
        return formProperties;
    }

    public void setFormProperties(String formProperties) {
        this.formProperties = formProperties;
    }

    public String getFlowDeploymentId() {
        return flowDeploymentId;
    }

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

    public String getRemark() {
        return remark;
    }

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

    public String getUserIds() {
        return userIds;
    }

    public void setUserIds(String userIds) {
        this.userIds = userIds;
    }

    public String getAttachmentIds() {
        return attachmentIds;
    }

    public void setAttachmentIds(String attachmentIds) {
        this.attachmentIds = attachmentIds;
    }

    public String getProblemNo() {
        return problemNo;
    }

    public void setProblemNo(String problemNo) {
        this.problemNo = problemNo;
    }

    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 String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public QualityProblemTypeEnum getType() {
        return type;
    }

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

    public QualityProblemReasonEnum getReason() {
        return reason;
    }

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

    public InfluenceDegreeEnum getInfluenceDegree() {
        return influenceDegree;
    }

    public void setInfluenceDegree(InfluenceDegreeEnum influenceDegree) {
        this.influenceDegree = influenceDegree;
    }
}
