package com.goafanti.common.enums;

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

public enum roleResources {
	/**意向客户 */
	YXKH(	0, "意向客户"),
	/**签单业务  */
	QDYW(1, "签单业务 "),
	/**客户资料  */
	KHZL(2, "客户资料 "),
	/**已签订单 */
	YQDD(3, "已签订单"), 
	/**项目任务  */
	XMRW(	4, "项目任务 "),
	/**科技需求 */
	KJXQ(	5, "科技需求"), 
	/**科技成果 */
	KJCG(	6, "科技成果"),
	/**签单客户 */
	QDKH(	8, "签单客户"),
	OTHER(99, "未知参数");
	
	private Integer	code;
	private String	desc;
	
	private static Map<Integer, roleResources> status = new HashMap<Integer, roleResources>();
	
	private roleResources(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (roleResources value : roleResources.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static roleResources getField(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return OTHER;
	}
	
	public static String getFieldDesc(Integer code) {
		return getField(code).getDesc();
	}

	public static boolean containsType(Integer code) {
		return status.containsKey(code);
	}
	
	public Integer getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}

}
