package com.hzjt.domain;

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

/**
 * @author chenl
 * @version 1.0
 * @date 2020/3/15 10:47
 */
public class CodeConst {
    //设备注册
    public static final Integer device_regist = 1;
    //设备更新
    public static final Integer device_update = 2;
    //设备下架
    public static final Integer device_remove = 3;
    //状态报告
    public static final Integer device_report = 4;

    private static Map<Integer, String> eventType = new HashMap<>();

    private static Map<String, Integer> eventTypeQZ = new HashMap<>();

    static {
        eventType.put(1, "异常停车");
        eventType.put(2, "行人/非机动车闯入");
        eventType.put(3, "倒行/逆行");
        eventType.put(4, "拥堵");
        eventType.put(5, "交通事件(事故发生)");
        eventType.put(6, "恶劣天气-雨");
        eventType.put(7, "恶劣天气-雪");
        eventType.put(8, "烟火报警");
        eventType.put(9, "烟雾报警");
        eventType.put(10, "能见度过低");
        eventType.put(11, "异常缓驶");
        eventType.put(12, "路面障碍物");
        eventType.put(13, "道路施工");
        eventType.put(14, "拥堵结束");
        eventType.put(15, "缓行结束");
        eventType.put(16, "特殊事件");
        eventType.put(17, "交通事件(事故行人下车)");
        eventType.put(18, "其他事件");
    }

    static {
        eventTypeQZ.put("congestion", 4);// 'congestion', '交通拥堵检测'
        eventTypeQZ.put("not_congestion", 14);// 'not_congestion', '拥堵结束'
        eventTypeQZ.put("illegal_parking", 1);// 'illegal_parking', '车辆异常停驶检测'
        eventTypeQZ.put("wrong_direction", 3);// 'wrong_direction', '倒车/逆行检测'
        eventTypeQZ.put("no_motor_ban", 2);// 'no_motor_ban', '行人/非机动车闯入检测'
        eventTypeQZ.put("slow_deive", 11);// 'slow_deive', '车辆异常缓行检测'
        eventTypeQZ.put("not_slow_deive", 15);// 'not_slow_deive', '缓行结束'
        eventTypeQZ.put("single_slow_drive", 11);// 'single_slow_drive', '高速公路车辆单车异常缓行检测'
        eventTypeQZ.put("accident", 5);// 'accident', '高速公路交通事故检测'
        eventTypeQZ.put("roadworks", 13);// 'roadworks', '高速公路道路施工检测'
        eventTypeQZ.put("roadworks_out_of_line", 19);// 'roadworks_out_of_line', '高速公路施工违规检测'
        eventTypeQZ.put("severe_weather", 6);// 'severe_weather', '恶劣天气（雨雪）检测'
        eventTypeQZ.put("low_visibility", 10);// 'low_visibility', '交通雾天检测'
        eventTypeQZ.put("abandoned_object", 12);// 'abandoned_object', '路面障碍物检测'
        eventTypeQZ.put("tunnel_fire", 8);// 'tunnel_fire', '高速公路隧道火焰检测'
        eventTypeQZ.put("tunnel_smoke", 9);// 'tunnel_smoke', '高速公路隧道烟体检测'
        eventTypeQZ.put("outside_fire", 8);// 'outside_fire', '交通室外火焰检测'
        eventTypeQZ.put("outside_smoke", 9);// 'outside_smoke', '交通室外烟体检测'
    }

    public static String getEventType(int type) {
        if (eventType.containsKey(type)) {
            return eventType.get(type);
        }
        return null;
    }

    public static Integer getEventTypeQZ(String type) {
        if (eventTypeQZ.containsKey(type)) {
            Integer code = eventTypeQZ.get(type);
            return code == null ? 18 : code;
        }
        return 18;
    }
}
