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

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

/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 2021/4/23 下午4:57
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/4/23 下午4:57
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum CommonDirectionEnum {


	负向(-1, "负向"),
	正向(1, "正向");

	private Integer key;
	private String  desc;

	CommonDirectionEnum(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 (CommonDirectionEnum c : CommonDirectionEnum.values()) {
			if (c.key.equals(key)) {
				return c.getDesc();
			}
		}
//		return null;
		return "未开票";
	}

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

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

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