package com.haha.common.enums;

public enum NotifyType {

    DEVICE_STATUS("DEVICE_STATUS", "开关门状态通知"),
    ONLINE_STATUS("ONLINE_STATUS", "设备在线状态通知"),
    VOICE_RESULT("VOICE_RESULT", "音量调节结果通知"),
    CLIENT_NEW_PRODUCT("CLIENT_NEW_PRODUCT", "新品审核结果回调"),
    MERGE_PRODUCT("MERGE_PRODUCT", "商品合并结果通知"),
    ORC_RESULT("ORC_RESULT", "AI识别结果通知");

    private final String code;
    private final String description;

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

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static NotifyType fromCode(String code) {
        if (code == null) {
            return null;
        }
        for (NotifyType type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        return null;
    }

    public static boolean isValid(String code) {
        return fromCode(code) != null;
    }
}
