package com.goafanti.common.enums;

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

public enum OrgActivityFields {
	
	UID("uid", "用户id"),
	ACTIVITYNUMBER("activityNumber", "研发活动编号"),
	ACTIVITYNAME("activityName", "研发活动名称"),
	STARTDATE("startDate", "开始日期"),
	ENDDATE("endDate", "结束日期"),
	PARTICIPANT("participant", "参与人员"),
	PROJECTMODE("projectMode", "是否是内部立项"),
	TECHNICALFIELD1("technicalField1", "技术领域1"),
	TECHNICALFIELD2("technicalField2", "技术领域2"),
	TECHNICALFIELD3("technicalField3", "技术领域3"),
	TECHNICALSOURCE("technicalSource", "技术来源"),
	INTELLECTUALPROPERTYNUMBER("intellectualPropertyNumber", "知识产权编号"),
	BUDGET("budget", "预算(万元)"),
	FIRSTYEAREXPENDITURE("firstYearExpenditure", "第一年研发经费支出(万元)"),
	SECONDYEAREXPENDITURE("secondYearExpenditure", "第二年研发经费支出(万元)"),
	THIRDYEAREXPENDITURE("thirdYearExpenditure", "第三年研发经费支出(万元)"),
	IMPLEMENT("implement", "目的及组织实施方式"),
	TECHNOLOGYINNOVATION("technologyInnovation", "核心技术及创新点"),
	ACHIEVEMENT("achievement", "取得的阶段性成果"),
	PROOFURL("proofUrl", "立项证明材料URL"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, OrgActivityFields> status = new HashMap<String, OrgActivityFields>();
	
	private OrgActivityFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (OrgActivityFields value : OrgActivityFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static OrgActivityFields 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;
	}

}
