package cn.superdesk.uniorder.common.enums.thirdpart.szhtxx.electronicInvoice;

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

/**
 * @Description: 发票类型 0-专票;2-普票;41-卷票;42-二手车;51-电子票;52-电子专票;12-机动车发票;不传默认电子发票
 * @Author: linjinyu
 * @CreateDate: 2022/3/23 11:26 上午
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/3/23 11:26 上午
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum SzhtxxElectronicInvoiceFptxxInvoiceTypeEnum {


//    0:专票
//    2:普票
//    41:卷票
//    42:二手车
//    51:电子票
//    52:电子专票
//    12机动车发票
//    不传默认电子发票

    专票(0, "专票"),
    普票(2, "普票"),
    卷票(41, "卷票"),
    二手车(42, "二手车"),
    电子票(51, "电子票"),
    电子专票(52, "电子专票"),
    机动车发票(12, "机动车发票"),
//            不传默认电子发票


    ;

    private Integer key;
    private String  desc;

    SzhtxxElectronicInvoiceFptxxInvoiceTypeEnum(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 (SzhtxxElectronicInvoiceFptxxInvoiceTypeEnum c : SzhtxxElectronicInvoiceFptxxInvoiceTypeEnum.values()) {
            if (c.key.equals(key)) {
                return c.getDesc();
            }
        }
        return null;
    }

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

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

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