package com.goafanti.common.enums;

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

public enum CertifySubmitType {
	
	SAVE("save", "保存"), 
	SUBMIT("submit", "保存并提交"),
	DEFAULT("other", "其他");

	private CertifySubmitType(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	private static Map<String, CertifySubmitType> status = new HashMap<String, CertifySubmitType>();

	static {
		for (CertifySubmitType value : CertifySubmitType.values()) {
			status.put(value.getCode(), value);
		}
	}

	public static CertifySubmitType getField(String code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return DEFAULT;
	}

	public static String getFieldDesc(String code) {
		return getField(code).getDesc();
	}

	public static boolean containsType(String code) {
		return status.containsKey(code);
	}

	private String	code;
	private String	desc;

	public String getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}

}
