package com.cmvr.framework.websocket.enums;

import lombok.Getter;

@Getter
public enum WSMessageTypeEnum {
    COMMON("common"),
    CHANNEL_SUBSCRIPTION("channel_subscription"),
    CAMERA_COMMAND("camera_command"),
    CAMERA_STREAM("camera_stream"),
    HEARTBEAT("heartbeat"),
    ERROR("error");

    private final String value;

    WSMessageTypeEnum(String value) {
        this.value = value;
    }

    public static WSMessageTypeEnum fromValue(String value) {
        for (WSMessageTypeEnum type : values()) {
            if (type.value.equals(value)) {
                return type;
            }
        }
        throw new IllegalArgumentException("未知消息类型: " + value);
    }
}
