package com.lantone.external.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 是否归档
 * @author: songxl
 * @time: 2022/3/4 16:03
 */
public enum IsPlacefileEnum {
    N("0", "未归档"),
    Y("1", "已归档");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

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

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

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