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

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

/**
 * @Description: 冲红原因 普通发票、电子普通发票、卷票冲红需给出冲红原因
 * 1-销货退回;2-开票有误;3-服务中止;4-销售折让;
 * 对于冲红原因为 1、2、3 的，会执行本地校验和联网校验两项检查，只要其中一项检查不通过，不允许开具红票，其它：为空
 * @Author: linjinyu
 * @CreateDate: 2022/3/23 11:35 上午
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/3/23 11:35 上午
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum SzhtxxElectronicInvoiceFptxxRedReasonEnum {

    销货退回(1, "销货退回"),
    开票有误(2, "开票有误"),
    服务中止(3, "服务中止"),
    销售折让(4, "销售折让"),

    ;

    private Integer key;
    private String  desc;

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

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

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

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