package com.goafanti.common.enums;

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

public enum DemandImportFields {
	DATACATEGORY("dataCategory", " 数据类别"),
	NAME("name", "科技成果名称"),
	KEYWORD("keyword", "关键词"),
	DEMANDTYPE("demandType", "需求类型"),
	PROBLEMDES("problemDes", "问题说明"),
	EMPLOYERNAME("employerName", "雇主名称"),
	EMPLOYERCONTACTS("employerContacts", "雇主联系人名称"),
	
	EMPLOYERCONTACTSMOBILE("employerContactsMobile", "雇主联系人电话"),
	EMPLOYERCONTACTSMAILBOX("employerContactsMailbox", "雇主联系人邮箱"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, DemandImportFields> status = new HashMap<String, DemandImportFields>();
	
	private DemandImportFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (DemandImportFields value : DemandImportFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static DemandImportFields 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;
	}

}
