package com.goafanti.common.enums;

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

public enum FinanceRatepayFields {
	MANAGEMENTCOST("managementCost", "管理费用"),
	OPERATINGPROFIT("operatingProfit", "营业利润"),
	RESEARCHCOST("researchCost", "研发费用"),
	GROSSPROFIT("grossProfit", "利润总额"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, FinanceRatepayFields> status = new HashMap<String, FinanceRatepayFields>();
	
	private FinanceRatepayFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (FinanceRatepayFields value : FinanceRatepayFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static FinanceRatepayFields 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;
	}

}
