package com.goafanti.common.enums;

import org.apache.commons.lang3.StringUtils;

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


public enum OrderLogProcess {
//	流程1=提交，2=审核，3=驳回，4=特批，5=财务审核 ，25=项目总监审核，6=财务首付，7=项目订单派单，8=项目派单，9=项目完成，0=发起退单，10=退单完成，11=财务全款，
//	12=离职转交，13=发起会员项目，14=订单外包驳回，15=项目外包通过，16=项目外包驳回，17=订单离职转交，18=会员项目发起，19=会员财务通过，
//	20=会员特批通过，21=会员财务驳回，22=会员特批驳回，23=会员项目完成
	TJ(1, "营销员提交"),
	SH(2, "管理员审核"),
	BH(3, "驳回"),
	TP(4, "特批通过"),
	CWSH(5, "财务审核"),
	CWFS(26,"财务复审"),
	XMZJSH(25, "项目总监审核"),
	CWSF(6, "财务首付"),
	XMZJPD(7, "项目总监派单"),
	XMJLPD(8, "项目经理派单"),
	XMWC(9, "项目完成"),
	FQTD(0,"发起退单"),
	WCTD(10,"退单完成"),
	CWQK(11,"财务全款"),
	FQWB(12,"发起外包"),
	WBTG(13,"订单外包通过"),
	WBBH(14,"订单外包驳回"),
	XMWBTG(15,"项目外包通过"),
	XMWBBH(16,"项目外包驳回"),
	DDLZZJ(17,"订单离职转交"),
	YXJLTT(18,"营销经理审核"),
	HYCWTG(19,"会员财务通过"),
	HYTPTG(20,"会员特批通过"),
	HYCWBH(21,"会员财务驳回"),
	HYTPBH(22,"会员特批驳回"),
	HYXMWC(23,"会员项目完成"),
	DDZJ(24,"订单转交"),

	YYBZSHTG(26,"运营保障审核通过"),
	YYBZSHBH(27,"运营保障审核驳回"),
	NOT(99,"未知"),
	;

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

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

	static {
		for (OrderLogProcess value : OrderLogProcess.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static String getValueByCode(Integer code){
        for(OrderLogProcess orderLogProcess:OrderLogProcess.values()){
            if(code.equals(orderLogProcess.getCode())){
                return orderLogProcess.getDesc();
            }
        }
        return  NOT.getDesc();
    }


	public static OrderLogProcess getStatus(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return null;
	}

	public static OrderLogProcess getStatus(String code) {
		if (StringUtils.isNumeric(code)) {
			return getStatus(Integer.parseInt(code));
		}
		return null;
	}

	public static boolean containsType(Integer code) {
		return status.containsKey(code);
	}

	private Integer	code;
	private String	desc;

	public Integer getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}
}
