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

import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.workflow.api.pojo.config.node.NodeData;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;

@TableName(value = "flow_design_node", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
public class Node extends BaseEntity {

    @TableId(value = "node_id", type = IdType.ASSIGN_ID)
    @ChineseDescription("主键id")
    private Long nodeId;

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

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

    @TableField("node_name")
    @ChineseDescription("节点名称")
    private String nodeName;

    @TableField("node_type")
    @ChineseDescription(
            "节点类型：10-开始节点，11-结束节点，12-子流程，20-消息监听，30-审批，31-抄送，40,-自定义活动，50-条件网关，51-并行网关，52-事件网关")
    private Integer nodeType;

    @TableField("short_content")
    @ChineseDescription("摘要性显示内容")
    private String shortContent;

    @TableField(value = "node_data", typeHandler = JacksonTypeHandler.class)
    @ChineseDescription("节点的具体详情配置")
    private NodeData nodeData;

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

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

}
