package com.cmvr.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum WebSocketMessageType {

    COMMON(100, "普通消息"),

    TASK(101, "Node-RED 交互");

    private final int code;
    private final String description;

    public static WebSocketMessageType fromCode(int code) {
        for (WebSocketMessageType value : values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }
}
