package com.fs.watch.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.Objects;
import java.util.stream.Stream;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum WatchSpo2StatusEnum {

    NORMAL(0,"正常"),
    LOW(1,"低氧血症"),
    EXHAUSTION(2,"呼吸衰竭");

    private Integer value;
    private String desc;

    public static WatchSpo2StatusEnum toType(Integer value) {
        return Stream.of(WatchSpo2StatusEnum.values())
                .filter(p -> Objects.equals(p.value, value))
                .findAny()
                .orElse(null);
    }
}
