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

    HYPERGLYCEMIA(1,"高风险(糖尿病)"),
    HYPOGLYCEMIA(2,"不良 (低血糖)"),
    HIGHER(3,"较高(糖尿病前期)"),
    GENERAL(4,"良好"),
    NORMAL(5,"正常");

    private Integer value;
    private String desc;

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