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

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

/**
 * @Description: 系统登陆类型
 * @Author: linjinyu
 * @CreateDate: 2021/11/24 下午2:27
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/11/24 下午2:27
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum SysLoginTypeEnum {

	匿名(-1, "匿名"),
	统一订单(0, "统一订单"),
	服务之窗(1, "服务之窗"),
	福利商城_侨城汇(2, "福利商城_侨城汇"),
	;

	private Integer key;
	private String  desc;

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

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

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

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