package cn.stylefeng.workflow.api.entity.instance;

import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.annotation.EnumFieldFormat;
import cn.stylefeng.workflow.api.enums.NodeStatusEnum;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

@TableName("flow_engine_runtime_node")
@Data
@EqualsAndHashCode(callSuper = true)
public class RuntimeNode extends BaseEntity {

    @TableId(value = "ru_node_id", type = IdType.ASSIGN_ID)
    @ChineseDescription("主键")
    private Long ruNodeId;

    @TableField("instance_id")
    @ChineseDescription("流程运行实例id")
    private Long instanceId;

    @TableField("model_id")
    @ChineseDescription("流程模型id")
    private Long modelId;

    @TableField("definition_id")
    @ChineseDescription("流程定义id")
    private Long definitionId;

    @TableField("node_id")
    @ChineseDescription("流程节点id，对应flow_design_node的主键id")
    private Long nodeId;

    @TableField("node_name")
    @ChineseDescription("节点名称，同flow_design_node表")
    private String nodeName;

    @TableField("node_type")
    @ChineseDescription("节点类型，同flow_design_node表")
    private Integer nodeType;

    @TableField("node_status")
    @ChineseDescription("节点流经状态：-10-空状态，10-未进行，20-进行中，30-已完成，40-已跳过，50-已拒绝，60-已退回，70-已转交")
    @EnumFieldFormat(processEnum = NodeStatusEnum.class)
    private Integer nodeStatus;

    @TableField("back_type")
    @ChineseDescription("退回类型：1-退回当前节点，2-退回所有节点")
    private Integer backType;

    @TableField(value = "version_flag", fill = FieldFill.INSERT)
    @ChineseDescription("乐观锁")
    @Version
    private Long versionFlag;

    @TableField(value = "tenant_id", fill = FieldFill.INSERT)
    @ChineseDescription("租户号")
    private Long tenantId;

}
