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

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

/**
 * @Description: 侨城汇供应商|商户 开票状态 0-未开票;1-已开票;2-已撤消;
 * @Author: linjinyu
 * @CreateDate: 7/29/20 7:19 PM
 * @UpdateUser: linjinyu
 * @UpdateDate: 7/29/20 7:19 PM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum InvoiceApplySupplierMakeInvoiceStatusEnum {

	未开票(0, "未开票"),
	已开票(1, "已开票"),
	已撤消(2, "已撤消"),// 已撤消<-重新开票
	;

	private Integer key;
	private String  desc;

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

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

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

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