package com.goafanti.common.enums;

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

public enum OrgTechCenterFields {
	
	UID("uid", "用户id"),
	CENTERNAME("centerName", "技术中心名称"),
	PRINCIPAL("principal", "负责人"),
	COMMENT("comment", "备注"),
	SYSTEMURL("systemUrl", "制度目录URL"),
	SYSTEMCATALOG("systemCatalog", "制度目录"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, OrgTechCenterFields> status = new HashMap<String, OrgTechCenterFields>();
	
	private OrgTechCenterFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (OrgTechCenterFields value : OrgTechCenterFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static OrgTechCenterFields 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;
	}

}
