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

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

/**
 * @Description: 等同 AccountingOrderInvoiceStatus
 * @Author: linjinyu
 * @CreateDate: 8/5/20 4:24 PM
 * @UpdateUser: linjinyu
 * @UpdateDate: 8/5/20 4:24 PM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum UnifiedOrderInvoiceStateEnum {

	未开票(0, "未开票"),
	全部开票(1, "全部开票"),
	部分开票(2, "部分开票"),
	;

	private Integer key;
	private String  desc;

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

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

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

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

}
