package cn.superdesk.uniorder.common.security.sensitive.constants;

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


/**
 * @Description: 数据脱敏 开关
 * @Author: linjinyu
 * @CreateDate: 2021/11/26 上午11:29
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/11/26 上午11:29
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum SensitiveRequireSwitchEnum {


	On(1, "开"),
	Off(0, "关"),
	;

	private Integer key;
	private String  desc;

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

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

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

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