package com.lantone.security.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 已读未读注解
 * @author: gaodm
 * @time: 2018/9/3 16:01
 */
public enum ReadTypeEnum {

    NOT_READ("0", "未读"),
    READ("1", "已读");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

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

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

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