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 WatchTemperatureStatusEnum {

    NORMAL(0,"正常"),
    LOW(1,"体温过低"),
    HIGH(2,"发热");

    private Integer value;
    private String desc;

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