package cn.fateverse.workflow.entity;

import cn.fateverse.common.core.annotaion.EnableAutoField;
import cn.fateverse.common.core.entity.BaseEntity;
import cn.fateverse.common.core.entity.Option;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author Clay
 * @date 2023-03-27
 */
@Data
@Builder
@EnableAutoField
@AllArgsConstructor
@NoArgsConstructor
public class ProcessListener extends BaseEntity {
    //监听器id
    private String id;
    //监听器类型 1 : 任务监听 2: 执行监听
    private String listenerType;
    //监听类型 create assignment complete end take
    private String eventType;
    //监听器名称
    private String listenerName;
    //监听器值
    private String listenerValue;
    //监听器数据类型 0: Java类 1: 表达式 2: 代理表达式
    private String listenerValueType;

    public Option toOption(){
        return Option.builder()
                .value(id)
                .label(listenerName)
                .build();
    }
}
