package com.lantone.daqe.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 丢失状态注解
 * @author: songxl
 * @time: 2022/3/4 16:03
 */
public enum LossStatusEnum {
    IS_LOSS("0", "已丢失"),
    NOT_LOSS("1", "已恢复");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

    LossStatusEnum(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public static LossStatusEnum getEnum(String key) {
        for (LossStatusEnum item : LossStatusEnum.values()) {
            if (item.key.equals(key)) {
                return item;
            }
        }
        return null;
    }

    public static String getName(String key) {
        LossStatusEnum item = getEnum(key);
        return item != null ? item.name : null;
    }
}
