package com.goafanti.order.enums;

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

public enum ApprovalNewState {
	/** 非特批 **/
	FTP(0,"非特批"),
	/** 总裁待审核 **/
	TPDSH(1,"特批待审核"),
	/** 总裁通过 **/
	TPTG(2,"特批通过"),
	/** 总裁驳回 **/
	TPBH(3,"特批驳回"),
	/** 董事长待审核 **/
	DSZDSH(4,"董事长待审核"),
	/** 董事长通过 **/
	DSZTG(5,"董事长通过"),
	/** 董事长驳回 **/
	DSZBH(6,"董事长驳回"),
//	FZCDSH(7,"副总裁待审核"),
//	FZCTG(8,"副总裁通过"),
//	FZCBH(9,"副总裁驳回"),
	/** 无效 **/
	INVALID(10, "INVALID");

	private ApprovalNewState(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

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

	static {
		for (ApprovalNewState value : ApprovalNewState.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static String getValueByCode(Integer code){
        for(ApprovalNewState approvalNewState:ApprovalNewState.values()){
            if(code.equals(approvalNewState.getCode())){
                return approvalNewState.getDesc();
            }
        }
        return  null;
    }
	public static ApprovalNewState 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;
	}
}
