package com.goafanti.common.enums;

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

public enum TechProjectFields {

	UID("uid", "用户id"),
	CONTACTS("contacts", "联系人"),
	DEPARTMENT("department", "科技项目申报部门"),
	DISPATCHINFO("dispatchInfo", "派单信息"),
	PROJECTNAME("projectName", "项目名称"),
	PROJECTCATAGORY("projectCatagory", "项目类型"),
	TECHHFIELD("techField", "技术领域"),
	PROJECTDES("projectDes", "项目简介"),
	PROJECTMODE("projectMode", "是否立项"),
	PROJECTAPPROVAL("projectApproval", "立项金额"),
	SUBSIDY("subsidy", "是否补助"),
	CONSULTANT("consultant", "咨询师"),
	APPROVALURL("approvalUrl", "科技项目资料URL"),
	STATE("state", "科技项目状态"),
	PRINCIPAL("principal", "负责人"),
	COMMENT("comment", "备注"),
	SALESMAN("salesman", "营销员"),
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, TechProjectFields> status = new HashMap<String, TechProjectFields>();
	
	private TechProjectFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (TechProjectFields value : TechProjectFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static TechProjectFields 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;
	}

}
