package com.tofly.gpsboot.common.system;

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

/**
 * 代办任务类型(类型+路由)
 *
 * @author Zev
 */
@Getter
@AllArgsConstructor
public enum UserTaskTypeEnum {
    /**
     *
     */
    USER_TASK_TYPE_ORDINARY_MESSAGE("0", "普通消息", ""),
    USER_TASK_TYPE_ROB_MAINTENANCE("1", "抢维修", ""),
    USER_TASK_TYPE_INSPECTION("2", "巡检", ""),
    USER_TASK_TYPE_BUILD("3", "工地", ""),
    USER_TASK_TYPE_MAINTAIN("23","维护",""),
    USER_TASK_TYPE_TROUBLE("4", "隐患", ""),
    USER_TASK_TYPE_PIPELINE_REPAIR_ORDER("5", "管网工单", ""),
    USER_TASK_TYPE_BUSINESS_WORK_ORDER("6", "业务工单", ""),
    USER_TASK_TYPE_BASIC_DATA_PROCESSING("7", "基础数据处理", ""),
    USER_TASK_TYPE_DIFFERENCE_BETWEEN_PRODUCTION("8","产销差超高异常",""),
    USER_TASK_TYPE_PRODUCTION_MARKETING_DIFFERENCE("9","产销差超低异常",""),
    USER_TASK_TYPE_ORDER_DELAY_MESSAGE_REMINDER("08","业务工单延时消息提醒",""),
    USER_TASK_TYPE_QUALITY_ORDER("10","质检工单",""),
    USER_TASK_TYPE_REPORT("0001", "上报", ""),
    USER_TASK_TYPE_AUDIT("0002", "审核", ""),
    MESSAGE_TYPE_FILL_REPORT("124","app月运行记录填报上报",""),
//    USER_TASK_TYPE_TURNDOWN("0003","驳回",""),
    USER_TASK_TYPE_SHIFT_APPLICATION("111115", "交接班申请", ""),
    USER_TASK_TYPE_PRICE_ADJUSTMENT("111116", "单价调整月提醒", ""),
    USER_TASK_TYPE_WATER_CONSUMPTION("111117", "填写实际用水量", "");
    /**
     * 编码
     */
    private String code;
    /**
     * 内容
     */
    private String value;
    /**
     * 路由
     */
    private String route;

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

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

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

        for (UserTaskTypeEnum e : UserTaskTypeEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                route = e.route;
                break;
            }
        }
        return route;
    }
}
