package com.ruoyi.ss.device.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 设备状态
 * @author wjh
 * 2024/3/25
 */
@AllArgsConstructor
@Getter
public enum DeviceStatus {

    NORMAL("1", "正常"),
    USING("2", "使用中"),
    FIXING("3", "维修中");

    private final String status;
    private final String msg;

    public static DeviceStatus parse(String status) {
        for (DeviceStatus obj : DeviceStatus.values()) {
            if (Objects.equals(obj.getStatus(), status)) {
                return obj;
            }
        }
        throw new RuntimeException("不存在值为" + status + "的状态");
    }
}
