package com.diagbot.enums;

import lombok.Setter;

/**
 * @Description:消息通知已读未读状态注解
 * @Author: songxl
 * @time: 2022/4/12
 */

public enum NewsNoticeStatusEnum {
    NEWS_READ("1", "已读"),
    NEWS_NOT_READ("0", "未读");

    @Setter
    private String key;

    @Setter
    private String name;

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

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

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

    public String getKey() {
        return key;
    }

    public String getName() {
        return name;
    }
}

