package com.tofly.gpsboot.common.system;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.StringUtils;

/**
 * 工单状态 工单状态0:未派工,1:处理中, 2:驳回 , 3:审核中 ,4处理完成，5转移申请，6、已转移 7:完成
 * @author Zev
 */
@Getter
@AllArgsConstructor
public enum OrderStateEnum {
    /**
     *
     */
    ORDER_STATE_NOT_WORK("0","未派工"),
    ORDER_STATE_NOT_AUDIT("1","未审核"),
    ORDER_STATE_NOT_START("2","未开始"),
    ORDER_STATE_BEING_PERFORMED("3","正在执行"),
    ORDER_STATE_PROCESSING_COMPLETE("4","处理完成"),
    ORDER_STATE_EXECUTION_NOT_STARTED("5","已开始未执行"),
    ORDER_STATE_REJECTED("6","驳回"),
    ORDER_STATE_TRANSFER_APPLICATION("7","转移申请"),
    ORDER_STATE_BEEN_TRANSFERRED("8","已转移"),
    ORDER_STATE_OVERTIME("9","超时"),
    ORDER_STATE_TERMINATION("10","终止")
    ;
    /**
     * 编码
     */
    private String code;
    /**
     * 内容
     */
    private String value;

    public static String getCodeForValue(String code) {
        String path = "";
        if (StringUtils.isEmpty(code)) {
            return path;
        }

        for (OrderStateEnum e : OrderStateEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                path = e.value;
                break;
            }
        }
        return path;
    }
}
