package com.qmth.sop.business.bean.result;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.sop.business.entity.TBQualityProblemApply;
import com.qmth.sop.common.enums.FlowStatusEnum;
import com.qmth.sop.common.enums.ProductTypeEnum;
import com.qmth.sop.common.enums.TFCustomTypeEnum;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Objects;

public class TBQualityProblemApplyResult extends TBQualityProblemApply implements Serializable {

    @ApiModelProperty(value = "责任人")
    private String userNames;

    @ApiModelProperty(value = "客户名称")
    private String custom;

    @ApiModelProperty(value = "客户类型")
    private ProductTypeEnum customType;

    @ApiModelProperty(value = "客户类型")
    private String customTypeStr;

    @ApiModelProperty(value = "实施产品")
    private TFCustomTypeEnum sopType;

    @ApiModelProperty(value = "实施产品")
    private String sopTypeStr;

    @ApiModelProperty(value = "提交人")
    private String submitter;

    @ApiModelProperty(value = "提交时间")
    private Long submissionTime;

    @ApiModelProperty(value = "状态，START：已开始，AUDITING：审核中，REJECT：已驳回，END：已终止，FINISH：已结束")
    private FlowStatusEnum status;

    @ApiModelProperty(value = "状态，START：已开始，AUDITING：审核中，REJECT：已驳回，END：已终止，FINISH：已结束")
    private String statusStr;

    @ApiModelProperty(value = "更新时间")
    private Long updateDateTime;

    @ApiModelProperty(value = "当前节点")
    private Integer setup;

    @ApiModelProperty(value = "当前负责人")
    private String pendApproveUsers = "--";

    @ApiModelProperty(value = "流程id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long flowId;

    @ApiModelProperty(value = "流程任务节点名称")
    private String taskName;

    @ApiModelProperty(value = "流程任务节点key")
    private String taskDefKey;

    @ApiModelProperty(value = "流程任务id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long taskId;

    @ApiModelProperty(value = "是否是自己审核")
    boolean myself = false;

    public boolean isMyself() {
        return myself;
    }

    public void setMyself(boolean myself) {
        this.myself = myself;
    }

    public String getCustomTypeStr() {
        if (Objects.nonNull(customType)) {
            return customType.getTitle();
        } else {
            return customTypeStr;
        }
    }

    public void setCustomTypeStr(String customTypeStr) {
        this.customTypeStr = customTypeStr;
    }

    public String getSopTypeStr() {
        if (Objects.nonNull(sopType)) {
            return sopType.getTitle();
        } else {
            return sopTypeStr;
        }
    }

    public void setSopTypeStr(String sopTypeStr) {
        this.sopTypeStr = sopTypeStr;
    }


    public FlowStatusEnum getStatus() {
        return status;
    }

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

    public String getStatusStr() {
        if (Objects.nonNull(status)) {
            return status.getTitle();
        } else {
            return statusStr;
        }
    }

    public void setStatusStr(String statusStr) {
        this.statusStr = statusStr;
    }


    public Integer getSetup() {
        return setup;
    }

    public void setSetup(Integer setup) {
        this.setup = setup;
    }

    public Long getFlowId() {
        return flowId;
    }

    public void setFlowId(Long flowId) {
        this.flowId = flowId;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getTaskDefKey() {
        return taskDefKey;
    }

    public void setTaskDefKey(String taskDefKey) {
        this.taskDefKey = taskDefKey;
    }

    public Long getTaskId() {
        return taskId;
    }

    public void setTaskId(Long taskId) {
        this.taskId = taskId;
    }

    public String getCustom() {
        return custom;
    }

    public void setCustom(String custom) {
        this.custom = custom;
    }

    public ProductTypeEnum getCustomType() {
        return customType;
    }

    public void setCustomType(ProductTypeEnum customType) {
        this.customType = customType;
    }

    public TFCustomTypeEnum getSopType() {
        return sopType;
    }

    public void setSopType(TFCustomTypeEnum sopType) {
        this.sopType = sopType;
    }

    public String getSubmitter() {
        return submitter;
    }

    public void setSubmitter(String submitter) {
        this.submitter = submitter;
    }

    public Long getSubmissionTime() {
        return submissionTime;
    }

    public void setSubmissionTime(Long submissionTime) {
        this.submissionTime = submissionTime;
    }

    public Long getUpdateDateTime() {
        return updateDateTime;
    }

    public void setUpdateDateTime(Long updateDateTime) {
        this.updateDateTime = updateDateTime;
    }

    public String getPendApproveUsers() {
        return pendApproveUsers;
    }

    public void setPendApproveUsers(String pendApproveUsers) {
        this.pendApproveUsers = pendApproveUsers;
    }

    public String getUserNames() {
        return userNames;
    }

    public void setUserNames(String userNames) {
        this.userNames = userNames;
    }
}
