package com.lesingle.edu.common.enums;

import lombok.Getter;

/**
 * 通知接收者类型枚举
 */
@Getter
public enum NotificationRecipientType {

    ALL("ALL", "所有人"),
    TEACHER("TEACHER", "教师"),
    SCHOOL("SCHOOL", "学校管理员"),
    PARENT("PARENT", "家长"),
    STUDENT("STUDENT", "学生");

    private final String code;
    private final String description;

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

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

}
