package com.goafanti.order.enums;

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

public enum OrderProjectStatus {
	//项目状态 0未启动 1进行中 2项目交付 3项目验收 4项目完成

	XMWQD(0,"未启动"),
	XMJXZ(1,"进行中"),
	XMJF(2,"项目交付"),
	XMYS(3,"项目验收"),
	XMWC(4,"项目完成"),
	XMZT(5,"项目暂停"),
	INVALID(99,"未知");
	
	
	private OrderProjectStatus(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

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

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