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

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

/**
 * @Description: 用于区分处理开票申请时用的维度
 * @Author: linjinyu
 * @CreateDate: 2021/11/22 上午10:41
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/11/22 上午10:41
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum InvoiceApplyDimEnum {

	票申请(1, "票申请"),
	对账单(6, "对账单"),
	;

	private Integer key;
	private String  desc;

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

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

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

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