package com.goafanti.common.enums;

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

public enum UserInfoBoFields {
	
	UID("uid", "用户id"),
	RESIDENCEPROVINCE("residenceProvince", "居住地--省"),
	RESIDENCECITY("residenceCity", "居住地--市"),
	RESIDENCEAREA("residenceArea", "居住地--区"),
	PERSONPORTRAITURL("personPortraitUrl", "个人头像"),
	LIFEPHOTOURL("lifePhotoUrl", "生活照"),
	PERSONALPROFILE("personalProfile", "个人简介"),
	FIXEDTELAREA("fixedTelArea", "固定电话区号"),
	FIXEDTEL("fixedTel", "固定电话"),
	FIXEDTELEXTENSION("fixedTelExtension", "固定电话分机号"),
	QQ("qq", "QQ号码"),
	POSTALADDRESS("postalAddress", "通讯地址"),
	POSTCODE("postcode", "邮政编码"),
	NICKNAME("nickname", "昵称"),
	EMAIL("email", "邮箱"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, UserInfoBoFields> status = new HashMap<String, UserInfoBoFields>();
	
	private UserInfoBoFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (UserInfoBoFields value : UserInfoBoFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static UserInfoBoFields 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;
	}

}
