package com.goafanti.common.enums;

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

public enum DemandFields {
	
	DATACATEGORY("dataCategory", "数据类别"),
	NAME("name", "需求名称"),
	KEYWORD("keyword", "关键词"),
	INFOSOURCES("infoSources", "信息来源"),
	
	INDUSTRYCATEGORYA("industryCategoryA", "行业类别下拉A"),
	INDUSTRYCATEGORYB("industryCategoryB", "行业类别下拉B"),
	INDUSTRYCATEGORYC("industryCategoryC", "行业类别下拉C"),
	DEMANDTYPE("demandType", "需求类型"),
	PROBLEMDES("problemDes", "问题说明"),
	
	TECHNICALREQUIREMENTS("technicalRequirements", "技术指标要求"),
	PICTUREURL("pictureUrl", "需求文件--图片URL"),
	TEXTFILEURL("textFileUrl", "需求文件--文本文件"),
	VIDEOURL("videoUrl", "需求文件--视屏文件URL"),
	FIXEDBUDGET("fixedBudget", "固定预算"),
	
	FIXEDCYCLE("fixedCycle", "固定周期"),
	PEOPLENUMBER("peopleNumber", "固定人数"),
	FIXEDSCHEME("fixedScheme", "固定方案"),
	COSTESCROW("costEscrow", "费用托管"),
	BUDGETCOST("budgetCost", "预算费用"),
	
	EMPLOYERID("employerId", "雇主ID"),
	EMPLOYERNAME("employerName", "雇主名称"),
	EMPLOYERADDRESS("employerAddress", "雇主地址"),
	EMPLOYERCONTACTS("employerContacts", "雇主联系人名称"),
	EMPLOYERCONTACTSMOBILE("employerContactsMobile", "雇主联系人电话"),
	
	EMPLOYERCONTACTSMAILBOX("employerContactsMailbox", "雇主联系人邮箱"),
	CONTACTS("contacts", "联系人&联系方式"),
	STATUS("status", "需求状态"),
	RELEASESTATUS("releaseStatus", "是否发布"),
	PRINCIPALID("principalId", "营销人员ID"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, DemandFields> status = new HashMap<String, DemandFields>();
	
	private DemandFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (DemandFields value : DemandFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static DemandFields 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;
	}

}
