package com.goafanti.common.enums;

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

public enum UserEduFields {
	
	UID("uid", "用户id"),
	EDUCATION("education", "学历"),
	MAJORCATEGORY("majorCategory", "专业类别"),
	MAHORNAME("majorName", "专业名称"),
	GRADUATESCHOOL("graduateSchool", "毕业学校"),
	GRADUATIONTIMEYEAR("graduationTimeYear", "毕业时间(年份)"),
	GRADUATIONTIMEMONTH("graduationTimeMonth", "毕业时间(月)"),
	GRADUATIONTIMEDAY("graduationTimeDay", "毕业时间(日)"),
	DIPLOMAURL("diplomaUrl", "毕业证图URL"),
	DIPLOMACODE("diplomaCode", "毕业证编号"),
	DEGREEDIPLOMAURL("degreeDiplomaUrl", "学位证明图URL"),
	DEGREECODE("degreeCode", "学位证编号"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, UserEduFields> status = new HashMap<String, UserEduFields>();
	
	private UserEduFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (UserEduFields value : UserEduFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static UserEduFields 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;
	}


}
