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


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

/**
 * @Description: 核销状态 0-未核销;1-已核销;2-部分核销;
 * @Author: linjinyu
 * @CreateDate: 7/31/20 11:38 AM
 * @UpdateUser: linjinyu
 * @UpdateDate: 7/31/20 11:38 AM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum InvoiceBankStatusEnum {

	未核销(0, "未核销"),
	全部核销(1, "全部核销"),
	部分核销(2, "部分核销");

	private Integer key;
	private String  desc;

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

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

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

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