package com.goafanti.order.enums;

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

public enum ApprovalState {
	/** 正常  **/
	NORMAL(0,"NORMAL"),
	/** 废除 **/
	WAIT_AUDIT(1,"ABOLISH"),
	/** 审核通过 **/
	AUDIT_PASS(2,"AUDIT_PASS"),
	/** 审核通过 **/
	AUDIT_REFUSE(3,"AUDIT_REFUSE"),
	/** 无效 **/
	INVALID(10, "INVALID");
	
	private ApprovalState(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

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

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