package com.fs.enums;

/**
 * @author MixLiu
 * @date 2026/1/28 10:43
 * @description 流程节点类型枚举
 */
public enum NodeTypeEnum {
    /**
     * 开始节点
     */
    START("START", "开始节点",1),

    /**
     * 结束节点
     */
    END("END", "结束节点",2),

    /**
     * 条件判断节点
     */
    CONDITION("CONDITION", "条件判断节点",3),

    /**
     * 延时节点
     */
    DELAY("DELAY", "延时节点",4),

    /**
     * 外呼任务节点
     */
    OUTBOUND_TASK("OUTBOUND_TASK", "外呼任务节点",5),

    /**
     * AI外呼电话
     */
    AI_CALL_TASK("AI_CALL_TASK", "AI外呼电话",6),

    /**
     * AI发送短信
     */
    AI_SEND_MSG_TASK("AI_SEND_MSG_TASK", "AI发送短信",7),

    /**
     * AI添加微信
     */
    AI_ADD_WX_TASK("AI_ADD_WX_TASK", "AI添加微信",8),
    /**
     * AI企微添加个微
     */
    AI_QW_ADD_WX_TASK("AI_QW_ADD_WX_TASK", "AI企微添加个微",9),
    /**
     * AI添加微信(新)
     */
    AI_ADD_WX_TASK_NEW("AI_ADD_WX_TASK_NEW", "AI添加微信(新)", 10);

    private final String code;
    private final String description;
    private final Integer value;

    NodeTypeEnum(String code, String description, Integer value) {
        this.code = code;
        this.description = description;
        this.value = value;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
    public Integer getValue() {
        return value;
    }

    /**
     * 根据编码获取节点类型
     */
    public static NodeTypeEnum fromCode(String code) {
        for (NodeTypeEnum type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown NodeType: " + code);
    }
    public static NodeTypeEnum fromValue(Integer v) {
        for (NodeTypeEnum type : values()) {
            if (type.value.equals(v)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown NodeVal: " + v);
    }
}
