package com.goafanti.common.enums;

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

public enum OrganizationTechFields {
	
	UID("uid", "用户id"),
	TECHNICALPEOPLENUM("technicalPeopleNum", "技术人员数量"),
	SEARCHAREACATEGORY("searchAreaCategory", "重点研究领域类别"),
	SEARCHAREADET("searchAreaDet", "重点研究领域明细"),
	SPECIALTY("specialty", "擅长领域"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, OrganizationTechFields> status = new HashMap<String, OrganizationTechFields>();
	
	private OrganizationTechFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (OrganizationTechFields value : OrganizationTechFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static OrganizationTechFields getField(String code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return OTHER;
	}
	
	public static String getFieldDesc(String code) {
		return getField(code).getDesc();
	}

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

	public String getDesc() {
		return desc;
	}

}
