package com.goafanti.common.enums;

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

public enum MemberStatus{
	OTHER(null,"No This Filed"),
	NORMAL(0,"正常"),
	LOCK(1,"锁定"),
	OVERDUE(2,"过期");
	private MemberStatus(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	private static Map<Integer, MemberStatus> status = new HashMap<Integer, MemberStatus>();

	static {
		for (MemberStatus value : MemberStatus.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static MemberStatus 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);
	}
	private Integer	code;
	private String	desc;

	public Integer getCode() {
		return code;
	}
	public String getDesc() {
		return desc;
	}
}
