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

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

/**
 * @Description: 是否默认:0-正常;1-默认;
 * @Author: linjinyu
 * @CreateDate: 2021/5/6 下午3:12
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/5/6 下午3:12
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum CommonIsDefaultEnum {

	正常(0, "正常"),
	默认(1, "默认"),
	;

	private Integer key;
	private String  desc;

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

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

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

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

}
