package com.aegis.notification.domain;

/**
 * 通知渠道枚举
 * 
 * @author aegis
 */
public enum NotificationChannel {
    
    /** 站内消息 */
    STATION("station", "站内消息"),
    
    /** 短信 */
    SMS("sms", "短信"),
    
    /** 邮件 */
    EMAIL("email", "邮件"),
    
    /** 推送通知 */
    PUSH("push", "推送通知");
    
    private final String code;
    private final String name;
    
    NotificationChannel(String code, String name) {
        this.code = code;
        this.name = name;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getName() {
        return name;
    }
    
    /**
     * 根据代码获取枚举
     */
    public static NotificationChannel fromCode(String code) {
        for (NotificationChannel channel : values()) {
            if (channel.code.equals(code)) {
                return channel;
            }
        }
        return null;
    }
}