package com.ycwl.basic.integration.device.dto.status;

/**
 * 设备状态动作枚举
 */
public enum DeviceStatusActionEnum {

    /**
     * 设备注册
     */
    REGISTER("register"),

    /**
     * 设备保活
     */
    KEEPALIVE("keepalive"),

    /**
     * 设备注销
     */
    UNREGISTER("unregister");

    private final String action;

    DeviceStatusActionEnum(String action) {
        this.action = action;
    }

    public String getAction() {
        return action;
    }

    public static DeviceStatusActionEnum fromString(String action) {
        for (DeviceStatusActionEnum statusAction : values()) {
            if (statusAction.action.equalsIgnoreCase(action)) {
                return statusAction;
            }
        }
        throw new IllegalArgumentException("Unknown device status action: " + action);
    }
}