package com.lantone.daqe.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 丢失途径注解
 * @author: songxl
 * @time: 2022/3/4 16:03
 */
public enum LossWayEnum {
    OUT_LOSS("0", "外部丢失"),
    IN_LOSS("1", "内部丢失");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

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

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

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