package com.goafanti.common.enums;

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

public enum OrgFinanceFields {
	
	UID("uid", "用户id"),
	MAINBUSINESSINCOME("mainBusinessIncome", "主营业务收入(万元)"),
	MANAGEMENTCOST("managementCost", "管理费用(万元)"),
	OPERATINGPROFIT("operatingProfit", "营业利润(万元)"),
	VARIOUSTAX("variousTax", "支付的各项税费(万元)"),
	CURRENTASSET("currentAsset", "流动资产(万元)"),
	NETFIXEDASSET("netFixedAsset", "固定资产净额(万元)"),
	TOTALASSET("totalAsset", "资产总额(万元)"),
	NETASSET("netAsset", "所有者权益合计(万元)"),
	GROSSPROFIT("grossProfit", "利润总额(万元)"),
	NETPROFIT("netProfit", "净利润(万元)"),
	SALESREVENUE("salesRevenue", "销售收入(万元)"),
	FINANCEURL("financeUrl", "财务报表URL"),
	YEAR("year", "年份"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, OrgFinanceFields> status = new HashMap<String, OrgFinanceFields>();
	
	private OrgFinanceFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (OrgFinanceFields value : OrgFinanceFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static OrgFinanceFields 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;
	}

}
