package com.goafanti.easemob.enums;

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

public enum EasemonSysUsers {
	ADMIN_DDDT("ADMIN_DDDT", "订单动态"),
	ADMIN_XQDT("ADMIN_XQDT", "需求动态"),
	ADMIN_CGDT("ADMIN_CGDT", "成果动态"),
	ADMIN_XTXX("ADMIN_XTXX", "系统消息"),
	ADMIN_KF("ADMIN_KF", "系统客服");

	private EasemonSysUsers(String username, String nickname) {
		this.username = username;
		this.nickname = nickname;
	}

	private String	username;

	private String	nickname;

	public String getUsername() {
		return username;
	}

	public String getNickname() {
		return nickname;
	}

	private static Map<String, EasemonSysUsers> users = new HashMap<String, EasemonSysUsers>();

	static {
		for (EasemonSysUsers value : EasemonSysUsers.values()) {
			users.put(value.getUsername(), value);
		}
	}

	public static EasemonSysUsers getField(String code) {
		if (containsType(code)) {
			return users.get(code);
		}
		return ADMIN_XTXX;
	}

	public static String getNickname(String code) {
		return getField(code).getNickname();
	}

	public static boolean containsType(String code) {
		return users.containsKey(code);
	}

}
