package com.goafanti.common.enums;

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

public enum MobileCodeCheckOverTimeSign {
	
	REGISTER("register", "注册手机验证码"),
	RESETCODE("resetCode", "重置密码手机验证码"),
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, MobileCodeCheckOverTimeSign> status = new HashMap<String, MobileCodeCheckOverTimeSign>();
	
	private MobileCodeCheckOverTimeSign(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (MobileCodeCheckOverTimeSign value : MobileCodeCheckOverTimeSign.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static MobileCodeCheckOverTimeSign 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;
	}
}
