package cn.superdesk.uniorder.common.enums.invoice.customer;

import lombok.NoArgsConstructor;

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


/**
 * @Description: 作废标志:0-未作废;1-已作废
 * @Author: linjinyu
 * @CreateDate: 2021/8/10 下午12:18
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/8/10 下午12:18
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@NoArgsConstructor
public enum InvoiceApplyBecomeInvalidEnum {


    未作废(0, "未作废"),
    已作废(1, "已作废"),
    ;

    private Integer key;
    private String  desc;

    InvoiceApplyBecomeInvalidEnum(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 (InvoiceApplyBecomeInvalidEnum c : InvoiceApplyBecomeInvalidEnum.values()) {
            if (c.key.equals(key)) {
                return c.getDesc();
            }
        }
        return "未知状态";
    }

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

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

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