package com.goafanti.order.enums;

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

public enum TaskDistributionState {
	/** 未分配 **/
	 NOT_DISTRIBUTION(0,"未分配"),
	/** 部分分配 **/
	 PART_DISTRIBUTION(1,"部分分配"),
	 /** 全部分配 **/
	 ALL_DISTRIBUTION(2,"全部分配"),
	/** 无效 **/
	INVALID(10, "无效");
	
	private TaskDistributionState(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

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

	static {
		for (TaskDistributionState value : TaskDistributionState.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static TaskDistributionState 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;
	}
}
