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

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

/**
 * @Description: 报送状态:0-未报送;1-已报送;-1-报送失败;
 * @Author: linjinyu
 * @CreateDate: 2022/3/18 11:53 上午
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/3/18 11:53 上午
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum SzhtxxElectronicInvoiceFptxxPushedOutStatusEnum {

//①未报送：指该发票未上报税局；
//    A、深圳航信电子发票：均默认为“已报送”，无其他状态；
//    B、深圳航信纸质发票：初始默认为“未报送”，“已报送/报送失败”根据开票成功后异步调用发票上传接口后进行状态变更；
//②已报送：指该发票已上报税局；
//③报送失败：指该发票在调用接口时，接口返回失败，此状态目前仅“深圳航信纸质发票”有此状态；

    报送失败(-1, "报送失败"),
    未报送(0, "未报送"),
    已报送(1, "已报送"),
    ;

    private Integer key;
    private String  desc;

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

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

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

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

}
