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.workflow.api.pojo.InstanceContext;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;

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

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

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

    @TableField("timer_name")
    @ChineseDescription("定时任务名称")
    private String timerName;

    @TableField("timer_action_class")
    @ChineseDescription("定时任务类名")
    private String timerActionClass;

    @TableField("timer_cron")
    @ChineseDescription("cron表达式")
    private String timerCron;

    @TableField(value = "param_runtime_node_json", typeHandler = JacksonTypeHandler.class)
    @ChineseDescription("定时任务参数：运行时节点的信息")
    private RuntimeNode paramRuntimeNodeJson;

    @TableField(value = "param_instance_context_json", typeHandler = JacksonTypeHandler.class)
    @ChineseDescription("定时任务参数：流程实例的信息")
    private InstanceContext paramInstanceContextJson;

    @TableField("timer_status")
    @ChineseDescription("定时任务状态：1-启动，2-停止")
    private Integer timerStatus;

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

}
