package com.goafanti.common.enums;

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

public enum OrgStandardFields {
	UID("uid", "用户id"),
	STANDARDNAME("standardName", "标准名称"),
	STANDARDNUMBER("standardNumber", "标准编号"),
	STANDARDLEVEL("standardLevel", "标准级别"),
	PARTICIPATEWAY("participateWay", "参与方式"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, OrgStandardFields> status = new HashMap<String, OrgStandardFields>();
	
	private OrgStandardFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (OrgStandardFields value : OrgStandardFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static OrgStandardFields 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;
	}

}
