package com.lesingle.edu.common.enums;

import lombok.Getter;

/**
 * 班级教师角色枚举
 */
@Getter
public enum ClassTeacherRole {

    /**
     * 主班/班主任
     */
    MAIN("MAIN", "主班"),

    /**
     * 配班
     */
    ASSIST("ASSIST", "配班"),

    /**
     * 保育员
     */
    CARE("CARE", "保育员");

    private final String code;
    private final String description;

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

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

    /**
     * 判断是否为主班/班主任角色
     */
    public static boolean isPrimaryRole(String code) {
        return MAIN.getCode().equalsIgnoreCase(code);
    }

}
