package com.qmth.sop.business.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
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.enums.CustomFlowMultipleUserApproveTypeEnum;
import com.qmth.sop.common.enums.FlowApproveOperationEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * <p>
 * 流程流水表
 * </p>
 *
 * @author wangliang
 * @since 2023-07-17
 */
@ApiModel(value = "TFFlowLog对象", description = "流程流水表")
public class TFFlowLog extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "机构id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long orgId;

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

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

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

    @ApiModelProperty(value = "审核人id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long approveId;

    @ApiModelProperty(value = "审核步骤")
    private Integer approveSetup;

    @ApiModelProperty(value = "审核意见")
    private String approveRemark;

    @ApiModelProperty(value = "审批操作，START：提交，DRAFT：草稿，APPROVE：审批，REJECT：驳回，END：终止，CANCEL：撤销，EXCHANGE：转他人审批，FINISH：结束")
    private FlowApproveOperationEnum approveOperation;

    @ApiModelProperty(value = "待审核人id")
    private String pendApproveId;

    @ApiModelProperty(value = "附件id集合")
    @TableField(value = "attachment_ids", updateStrategy = FieldStrategy.IGNORED)
    private String attachmentIds;

    @ApiModelProperty(value = "审批步骤")
    @TableField(value = "approve_multi_setup", updateStrategy = FieldStrategy.IGNORED)
    private Integer approveMultiSetup;

    @ApiModelProperty(value = "审批用户类别，ORDER：依次审批，ALL：会签（所有人必须审批），SOME：或签（一名审批人同意或拒绝即可）")
    @TableField(value = "approve_user_approve_type", updateStrategy = FieldStrategy.IGNORED)
    private CustomFlowMultipleUserApproveTypeEnum approveUserApproveType;

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

    public TFFlowLog() {

    }

    public TFFlowLog(Long orgId, Long approveId, Long userId,
                     Integer approveSetup, Long flowId, Long taskId, Long objectId, String pendApproveId) {
        this.orgId = orgId;
        this.approveId = approveId;
        insertInfo(userId);
        this.approveSetup = approveSetup;
        this.flowId = flowId;
        this.taskId = taskId;
        this.objectId = objectId;
        this.pendApproveId = pendApproveId;
    }

    public Long getOrgId() {
        return orgId;
    }

    public void setOrgId(Long orgId) {
        this.orgId = orgId;
    }

    public Long getFlowId() {
        return flowId;
    }

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

    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 Long getApproveId() {
        return approveId;
    }

    public void setApproveId(Long approveId) {
        this.approveId = approveId;
    }

    public Integer getApproveSetup() {
        return approveSetup;
    }

    public void setApproveSetup(Integer approveSetup) {
        this.approveSetup = approveSetup;
    }

    public String getApproveRemark() {
        return approveRemark;
    }

    public void setApproveRemark(String approveRemark) {
        this.approveRemark = approveRemark;
    }

    public FlowApproveOperationEnum getApproveOperation() {
        return approveOperation;
    }

    public void setApproveOperation(FlowApproveOperationEnum approveOperation) {
        this.approveOperation = approveOperation;
    }

    public String getPendApproveId() {
        return pendApproveId;
    }

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

    public String getAttachmentIds() {
        return attachmentIds;
    }

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

    public Integer getApproveMultiSetup() {
        return approveMultiSetup;
    }

    public void setApproveMultiSetup(Integer approveMultiSetup) {
        this.approveMultiSetup = approveMultiSetup;
    }

    public CustomFlowMultipleUserApproveTypeEnum getApproveUserApproveType() {
        return approveUserApproveType;
    }

    public void setApproveUserApproveType(CustomFlowMultipleUserApproveTypeEnum approveUserApproveType) {
        this.approveUserApproveType = approveUserApproveType;
    }

    public Long getTaskId() {
        return taskId;
    }

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