package com.lesingle.edu.common.enums;

import lombok.Getter;

/**
 * 通知类型枚举
 */
@Getter
public enum NotificationType {

    SYSTEM("SYSTEM", "系统通知"),
    TASK("TASK", "任务通知"),
    SCHEDULE("SCHEDULE", "日程通知"),
    COURSE("COURSE", "课程通知");

    private final String code;
    private final String description;

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

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

}
