package com.goafanti.common.enums;

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

public enum OrgTechAchievementFields {
	UID("uid", "用户id"),
	ACHIEVEMENTNAME("achievementName", "成果名称"),
	SOURCE("source", "来源"),
	CONVERSIONFORM("conversionForm", "转化形式"),
	CONVERSIONRESULT("conversionResult", "转化结果"),
	ENCLOSUREURL("enclosureUrl", "证明材料附件URL"),
	YEAR("year", "年份"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, OrgTechAchievementFields> status = new HashMap<String, OrgTechAchievementFields>();
	
	private OrgTechAchievementFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (OrgTechAchievementFields value : OrgTechAchievementFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static OrgTechAchievementFields 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;
	}

}
