package com.diagbot.enums;

import lombok.Setter;

/**
 * @Description:消息通知类型注解
 * @Author: songxl
 * @time: 2022/4/12
 */

public enum NewsNoticeTypeEnum {
    CHECK_NEWS_WORK("1", "质控任务"),
    OTHER_NEWS_WORK("0", "其他任务");

    @Setter
    private String key;

    @Setter
    private String name;

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

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

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

    public String getKey() {
        return key;
    }

    public String getName() {
        return name;
    }
}

