package com.goafanti.order.enums;

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

/**
 * 订单阶段
 * @author Administrator
 *
 */
public enum OrderType {
	/** 意向阶段 **/
	RZXM(0,"认证项目"),
	/** 跟单阶段 **/
	KJXM(1,"科技项目"),
	/** 无效 **/
	INVALID(10, "无效");
	
	private OrderType(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	private static Map<Integer, OrderType> status = new HashMap<Integer, OrderType>();

	static {
		for (OrderType value : OrderType.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static OrderType getStatus(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return INVALID;
	}
	public static String getValueByCode(Integer code){
        for(OrderType orderType:OrderType.values()){
            if(code.equals(orderType.getCode())){
                return orderType.getDesc();
            }
        }
        return  null;
    }
	public static boolean containsType(Integer code) {
		return status.containsKey(code);
	}
	private Integer	code;
	private String	desc;
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
}
