package com.goafanti.common.enums;

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

public enum OrgHonorDatumFields {
	
	UID("uid", "用户id"),
	NAME("name", "荣誉或证明材料名称"),
	ISSUINGMECHANISM("issuingMechanism", "发证机构"),
	ENCLOSUREURL("enclosureUrl", "附件材料URL"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, OrgHonorDatumFields> status = new HashMap<String, OrgHonorDatumFields>();
	
	private OrgHonorDatumFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (OrgHonorDatumFields value : OrgHonorDatumFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static OrgHonorDatumFields 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;
	}

}
