package com.lantone.security.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 是否删除, N:未删除，Y:删除
 * @author: gaodm
 * @time: 2018/9/3 16:01
 */
public enum ReceiveTypeEnum {

    ALL("0", "所有人"),
    CUSTOM("1", "自定义");
    @Setter
    @Getter
    private String key;
    @Setter
    @Getter
    private String name;

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

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

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

}