package com.goafanti.common.enums;

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

public enum UserIdentityFields {
	UID("uid", "用户id"),
	USERNAME("username", " 姓名"),
	SEX("sex", "性别"),
	DATEOFBIRTH("dateOfBirthYear", "出生年"),
	DATEOFMONTH("dateOfBirthMonth", "出生月"),
	IDNUMBER("idNumber", "身份证号"),
	POSITIVEIDURL("positiveIdUrl", "身份证正面照URL"),
	OPPOSITEIDURL("oppositeIdUrl", "身份证反面照URL"),
	PROVINCE("province", "所在地省"),
	CITY("city", "所在地市"),
	AREA("area", "所在地区"),
	CONTACTMOBILE("contactMobile", "联系方式"),
	BANKNAME("bankName", "开户银行"),
	BANKCARDNUMBER("bankCardNumber", "银行卡号"),
	AMOUNTMONEY("amountMoney", "打款金额"),
	AUDITSTATUS("auditStatus", "审核状态"),
	PROCESS("process", "实名认证流程"),
	WRONGCOUNT("wrongCount", "输入错误打款金额次数"),
	PAYMENTDATE("paymentDate", "打款日期"),
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, UserIdentityFields> status = new HashMap<String, UserIdentityFields>();
	
	private UserIdentityFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (UserIdentityFields value : UserIdentityFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static UserIdentityFields 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;
	}
}
