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

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

public enum CommonIsInvalidEnum {

	正常(0, "正常"),
	作废(1, "作废"),
	;

	private Integer key;
	private String  desc;

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

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

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

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