package com.goafanti.common.enums;

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

public enum AchievementImportFields {
	DATACATEGORY("dataCategory", " 数据类别"),
	NAME("name", "科技成果名称"),
	KEYWORD("keyword", "关键词"),
	CATEGORY("category", "成果类型"),
	OWNERNAME("ownerName", "科技成果所有人名称"),
	OWNERTYPE("ownerType", "科技成果所有人类型"),
	OWNERIDNUMBER("ownerIdNumber", "科技成果所有人证件号"),
	
	OWNERMOBILE("ownerMobile", "科技成果所有人联系电话"),
	OWNEREMAIL("ownerEmail", "科技成果所有人电子邮箱"),
	OWNERPOSTALADDRESS("ownerPostalAddress", "科技成果所有人通讯地址"),
	COOPERATIONMODE("cooperationMode", "合作方式"),
	
	INTRODUCTION("introduction", "成果简介"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, AchievementImportFields> status = new HashMap<String, AchievementImportFields>();
	
	private AchievementImportFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (AchievementImportFields value : AchievementImportFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static AchievementImportFields 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;
	}
}
