package com.goafanti.order.enums;

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

/**
 * 订单阶段
 * @author Administrator
 *
 */
public enum OrderStage {
	/** 意向阶段 **/
	INTENTION(0,"意向阶段 "),
	/** 跟单阶段 **/
	FOLLOWING(1,"跟单阶段"),
	/** 合同阶段 **/
	SIGNED(2,"合同阶段"),
	/** 项目阶段 **/
	PROJECT(3, "项目阶段 "),
	/** 无效 **/
	INVALID(10, "无效");
	
	private OrderStage(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

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

	static {
		for (OrderStage value : OrderStage.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static OrderStage getStatus(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return INVALID;
	}
	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;
	}
}
