package cn.superdesk.uniorder.common.enums.sys.notify;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 这里的通知类型都是为了解决异步通讯的问题 与前端交互
 * 只是个引子吧，还能扩大
 * @Author: linjinyu
 * @CreateDate: 2022/7/12 10:05 上午
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/7/12 10:05 上午
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum SysNotifyCategoryDefaultEnum {

    系统预留(0, "系统预留"),

    /**************************************** 异步 start ****************************************/

    /**
     * {@link cn.superdesk.uniorder.dubbo.provider.sys.notify.DubboSysNotifyServiceImpl#commonNotifyInvoiceApplyCustomerScore}
     * {@link cn.superdesk.uniorder.dubbo.provider.sys.notify.DubboSysNotifyServiceImpl#commonNotifyExportExcel}
     * {@link cn.superdesk.uniorder.dubbo.provider.sys.notify.DubboSysNotifyServiceImpl#commonNotifyAsyncTask}
     */

    导出通知(1000, "导出通知"), // 特征 commonNotifyExportExcel sysNotify.setDetailLink("common/excel/export/f" + sysNotify.getContent());
    异步任务(1001, "异步任务"),


    ;

    private Integer key;
    private String  desc;

    SysNotifyCategoryDefaultEnum(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public Integer getKey() {
        return key;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDesc(Integer key) {
        for (SysNotifyCategoryDefaultEnum c : SysNotifyCategoryDefaultEnum.values()) {
            if (c.key.equals(key)) {
                return c.getDesc();
            }
        }
        return null;
    }

    private static final Map<Integer, SysNotifyCategoryDefaultEnum> LOOKUP = new HashMap<>();

    static {
        for (SysNotifyCategoryDefaultEnum s : EnumSet.allOf(SysNotifyCategoryDefaultEnum.class)) {
            LOOKUP.put(s.getKey(), s);
        }
    }

    public static SysNotifyCategoryDefaultEnum get(Integer key) {
        return LOOKUP.get(key);
    }
}
