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


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

/**
 * @Description: 数据完整性
 * @Author: linjinyu
 * @CreateDate: 2021/12/14 下午12:48
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/12/14 下午12:48
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum CommonDataIntegrityEnum {

	完整(0, "完整"), // integrity
	缺失(1, "缺失"), // lack missing
	;

	private Integer key;
	private String  desc;

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

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

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

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