package com.seer.teach.common.enums;

import java.util.Arrays;

public enum AiScenarioCodeEnum {

    /**
     * 知识点生成示例题目
     */
    KNOWLEDGE_POINT_GENERATE_EXAMPLE_QUESTIONS("knowledge_point_generate_example_questions", "知识点生成示例题目"),

    /**
     * 知识点生成题目
     */
    KNOWLEDGE_POINT_GENERATE_QUESTIONS("knowledge_point_generate_questions", "知识点生成题目"),

    /**
     * 解析教材
     */
    ANALYZE_TEACHING_MATERIAL("analyze_teaching_material", "解析教材"),

    /**
     * 知识点生成图片
     */
    KNOWLEDGE_POINT_GENERATE_IMAGES("knowledge_point_generate_images", "知识点生成图片"),

    /**
     * 知识点拆分
     */
    KNOWLEDGE_POINT_SPLIT("knowledge_point_split", "知识点拆分"),

    /**
     * 知识点检查
     */
    KNOWLEDGE_POINT_CHECK("knowledge_point_check", "知识点检查"),

    /**
     * 举一反三生成题目
     */
    LEARN_BY_ANALOGY_GENERATE_QUESTIONS("learn_by_analogy_generate_questions", "举一反三生成题目"),

    /**
     * 知识点生成教学目标
     */
    KNOWLEDGE_POINT_GENERATE_TEACH_GOALS("knowledge_point_generate_teach_goals", "知识点生成教学目标"),

    /**
     * 根据教学目标生成讲课稿
     */
    GENERATE_TEACH_TEXTS_FROM_GOALS("generate_teach_texts_from_goals", "根据教学目标生成讲课稿"),


    /**
     * 文本转语音
     */
    TEXT_TO_SPEECH("text_to_speech", "文本转语音"),

    /**
     * 根据讲课稿生成视频脚本
     */
    GENERATE_VIDEO_SCRIPT_FROM_TEACH_TEXTS("generate_video_script_from_teach_texts", "根据讲课稿生成视频脚本");

    private final String code;
    private final String message;

    AiScenarioCodeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    /**
     * 根据code获取枚举实例
     * <p>
     * <p>
     * <p>
     * * @param code 场景代码
     *
     * @return 对应的枚举实例，如果未找到则返回null
     */
    public static AiScenarioCodeEnum fromCode(String code) {
        return Arrays.stream(values())
                .filter(scenario -> scenario.code.equals(code))
                .findFirst()
                .orElse(null);
    }
}