package com.fizz.business.constants.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * 报警状态枚举
 *
 * @author chenhao
 * @date 2023/04/24
 */
@Getter
@AllArgsConstructor
public enum AlarmStatusEnum implements IEnum<String> {
    INIT("初始化"),
    UNCONFIRMED("报警待确认"),
    CONFIRM( "报警已确认")
    ;

    private final String desc;

    private static final Map<String, AlarmStatusEnum> MAP = new HashMap<>(16);

    static {
        for (AlarmStatusEnum e : AlarmStatusEnum.values()) {
            MAP.put(e.getValue(), e);
        }
    }

    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static AlarmStatusEnum getByValue(String value) {
        return MAP.get(value);
    }

    @JsonValue
    @Override
    public String getValue() {
        return this.name();
    }
}
