package com.goafanti.order.enums;

import com.goafanti.common.constant.ErrorConstants;

import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.Map;

public enum OrderLegalAffairsState {

	ORDERNO("orderNo","订单编号"),
	TYPE("type","法务分类"),
	STATUS("status","法务状态"),
	REMARKS("remarks","备注"),
	DATE("date","时间"),
	OTHER("", "未知参数");

	private OrderLegalAffairsState(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	private static Map<String, OrderLegalAffairsState> status = new HashMap<String, OrderLegalAffairsState>();

	static {
		for (OrderLegalAffairsState value : OrderLegalAffairsState.values()) {
			status.put(value.getCode(), value);
		}
	}

	public static OrderLegalAffairsState 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);
	}

	private String	code;
	private String	desc;

	public String getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}
}
