package com.goafanti.common.enums;

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

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