package com.qmth.distributed.print.business.bean.result;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.teachcloud.common.enums.FlowApproveSetupEnum;
import com.qmth.teachcloud.common.enums.FlowStatusEnum;
import io.swagger.annotations.ApiModelProperty;

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

/**
 * @Description: 流程审批列表
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2022/2/21
 */
public class FlowApproveListResult implements Serializable {

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

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

    @ApiModelProperty(value = "自定义流程实体id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long flowEntityId;

    @ApiModelProperty(value = "实体表")
    private String objectTable;

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

    @ApiModelProperty(value = "提交人id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long teacherId;

    @ApiModelProperty(value = "下一级处理人id/当前处理人")
    @JsonSerialize(using = ToStringSerializer.class)
    private String pendApproveId;

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

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

    @ApiModelProperty(value = "下一级处理人id/当前处理人")
    private String pendApproveUserName;

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

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

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

    @ApiModelProperty(value = "当前节点")
    private String setupStr;

    public Long getId() {
        return id;
    }

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

    public Long getFlowId() {
        return flowId;
    }

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

    public Long getFlowEntityId() {
        return flowEntityId;
    }

    public void setFlowEntityId(Long flowEntityId) {
        this.flowEntityId = flowEntityId;
    }

    public String getObjectTable() {
        return objectTable;
    }

    public void setObjectTable(String objectTable) {
        this.objectTable = objectTable;
    }

    public Long getObjectId() {
        return objectId;
    }

    public void setObjectId(Long objectId) {
        this.objectId = objectId;
    }

    public String getPendApproveId() {
        return pendApproveId;
    }

    public void setPendApproveId(String pendApproveId) {
        this.pendApproveId = pendApproveId;
    }

    public Long getCreateTime() {
        return createTime;
    }

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

    public Long getTeacherId() {
        return teacherId;
    }

    public void setTeacherId(Long teacherId) {
        this.teacherId = teacherId;
    }

    public String getTeacherUserName() {
        return teacherUserName;
    }

    public void setTeacherUserName(String teacherUserName) {
        this.teacherUserName = teacherUserName;
    }

    public String getPendApproveUserName() {
        return pendApproveUserName;
    }

    public void setPendApproveUserName(String pendApproveUserName) {
        this.pendApproveUserName = pendApproveUserName;
    }

    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 String getSetupStr() {
        if (Objects.nonNull(setup)) {
            switch (setup.intValue()) {
                case 1:
                    this.setupStr = FlowApproveSetupEnum.SUBMIT.getRemark();
                    break;
                case 0:
                    this.setupStr = FlowApproveSetupEnum.FINISH.getRemark();
                    break;
                case -1:
                    this.setupStr = FlowApproveSetupEnum.END.getRemark();
                    break;
                default:
                    this.setupStr = FlowApproveSetupEnum.APPROVE.getRemark();
                    break;
            }
        }
        return setupStr;
    }

    public void setSetupStr(String setupStr) {
        this.setupStr = setupStr;
    }
}
