package com.lesingle.edu.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 课程类型枚举
 */
@Getter
@AllArgsConstructor
public enum LessonTypeEnum {

    INTRODUCTION("INTRODUCTION", "导入课"),
    INTRO("INTRO", "导入课"),
    COLLECTIVE("COLLECTIVE", "集体课"),
    LANGUAGE("LANGUAGE", "语言课"),
    ART("ART", "艺术课"),
    MUSIC("MUSIC", "音乐课"),
    SPORT("SPORT", "体育课"),
    SCIENCE("SCIENCE", "科学课"),
    OUTDOOR("OUTDOOR", "户外课"),
    SOCIAL("SOCIAL", "社会课"),
    SOCIETY("SOCIETY", "社会课"),
    HEALTH("HEALTH", "健康课"),
    DOMAIN_HEALTH("DOMAIN_HEALTH", "健康课"),
    DOMAIN_LANGUAGE("DOMAIN_LANGUAGE", "语言课"),
    DOMAIN_SOCIAL("DOMAIN_SOCIAL", "社会课"),
    DOMAIN_SCIENCE("DOMAIN_SCIENCE", "科学课"),
    DOMAIN_ART("DOMAIN_ART", "艺术课");

    private final String code;
    private final String description;

    /**
     * 根据代码获取枚举
     */
    public static LessonTypeEnum fromCode(String code) {
        if (code == null) {
            return null;
        }
        for (LessonTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }

    /**
     * 验证代码是否有效
     */
    public static boolean isValidCode(String code) {
        return fromCode(code) != null;
    }
}