package com.goafanti.common.enums;

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

public enum AchievementOrderFields {
	
	ACHIEVEMENTID("achievementId", "科技需求ID"),
	STATUS("status", "状态"),
	INTENTIONMONEY("intentionMoney", "意向金"),
	CONTRACTMONEY("contractMoney", "合同金"),
	COMMISSION("commission", "佣金"),
	SERVICEMONEY("serviceMoney", "服务金"),
	COMMENT("comment", "备注"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, AchievementOrderFields> status = new HashMap<String, AchievementOrderFields>();
	
	private AchievementOrderFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (AchievementOrderFields value : AchievementOrderFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static AchievementOrderFields 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;
	}

}
