package com.ruoyi.device.mqtt.enums;

/**
 * 设备在线状态枚举
 *
 * @author lwm
 **/
public enum DeviceLineStatusEnum
{
    ON_LINE(1, "在线"),
    OFF_LINE(0, "离线"),
    ;

    private final Integer status;
    private final String message;

    DeviceLineStatusEnum(Integer status, String message)
    {
        this.status = status;
        this.message = message;
    }

    public Integer getStatus()
    {
        return status;
    }

    public String getMessage()
    {
        return message;
    }

    // 判断是否在线
    public static boolean isOnLine(Integer status)
    {
        if (status == null)
        {
            return false;
        }
        return DeviceLineStatusEnum.ON_LINE.getStatus().equals(status);
    }

    // 判断是否离线
    public static boolean isOffLine(Integer status)
    {
        return !isOnLine(status);
    }


}
