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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @author wjh
 * 2024/3/20
 */
@AllArgsConstructor
@Getter
public enum DevicePowerStatus {

    ON("1", "通电"),
    OFF("0", "断电");

    private final String status;
    private final String name;

    public static DevicePowerStatus parse(String status) {
        for (DevicePowerStatus obj : DevicePowerStatus.values()) {
            if (Objects.equals(obj.getStatus(), status)) {
                return obj;
            }
        }
        throw new RuntimeException("不存在值为" + status + "的通断电类型");
    }
}
