package cn.superdesk.uniorder.executor.scheduler.kafka._inner._constants.enums;

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

/**
 * @Description: 基于发票单触发的事件定义
 * @Author: linjinyu
 * @CreateDate: 2022/5/23 11:56 上午
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/5/23 11:56 上午
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum InvoiceApplyCustomerKafkaEventEnum {


    基于发票单触发_检验与更新对账单字段开票申请状态("CheckAndUpdateAccountingOrderFieldInvoiceStatusEvent", "基于发票单触发_检验与更新对账单字段开票申请状态"),

    ;

    /**
     * eventKey
     */
    private String key;
    /**
     * eventDesc
     */
    private String desc;

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

    public String getKey() {
        return key;
    }

    public String getDesc() {
        return desc;
    }

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

        return "未知事件";
    }

    private static final Map<String, InvoiceApplyCustomerKafkaEventEnum> LOOKUP = new HashMap<>();

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

    public static InvoiceApplyCustomerKafkaEventEnum get(String key) {
        return LOOKUP.get(key);
    }
}
