package com.lesingle.edu.common.enums;

import lombok.Getter;

/**
 * 日程计划来源类型枚举
 */
@Getter
public enum ScheduleSourceType {

    TEACHER("TEACHER", "教师创建"),
    SCHOOL("SCHOOL", "学校创建");

    private final String code;
    private final String description;

    ScheduleSourceType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public static ScheduleSourceType fromCode(String code) {
        if (code == null) {
            return TEACHER;
        }
        for (ScheduleSourceType type : values()) {
            if (type.getCode().equalsIgnoreCase(code)) {
                return type;
            }
        }
        return TEACHER;
    }

}
