package com.cmvr.test.enums;

import com.cmvr.common.exception.GlobalException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 流程场景类型
 */
@Getter
@AllArgsConstructor
public enum FlowSceneTypeEnum {
    NORMAL(0, "普通流程场景", "NORMAL"),
    VI_WAKEUP_CORPUS(1, "语音交互-唤醒场景", "VI_WAKEUP_CORPUS"),
    VI_SINGLE_CORPUS(2, "语音交互-单次对话场景", "VI_SINGLE_CORPUS"),
    VI_CONTINUOUS_CORPUS(3, "语音交互-连续对话场景", "VI_CONTINUOUS_CORPUS"),
    TI_TOUCH(4, "触控交互场景", "TI_TOUCH");

    private final int code;       // 数字类型
    private final String desc;    // 描述
    private final String sceneCode; // 数据库里存的 sceneCode

    // 根据 code 获取枚举
    public static FlowSceneTypeEnum fromCode(int code) {
        for (FlowSceneTypeEnum e : values()) {
            if (e.code == code) {
                return e;
            }
        }
        throw new GlobalException("场景类型参数错误: " + code);
    }
}