package com.cico.nest.lcdp.boot.core.qxsd.domain.event;

import java.util.Objects;

/**
 * 交通事件融合后的事件类型
 * @author rfx
 * @date 2024/11/15
 */
public enum EventTypeAllEnum {

    hasten(0, "急加速","111", "急加速",null, null),
    deceleration(1, "急减速","112", "急减速",null, null),
    implement_lane_changes(2, "违法变道","105","实线变道","66012","违法变道"),
    serpentine_driving(3,"蛇形驾驶","113","蛇形驾驶",null,null),
    retrograde(4,"逆行",null,null,"66005","逆行"),
    congestion(5,"拥堵","1","中度拥堵","66001","拥堵"),
    congestion2(5,"拥堵","2","严重拥堵","66001","拥堵"),

    suspicious_events(6,"可疑事件",null,"可疑事件",null,null),
    rear_end_chase(7,"事故",null,"追尾","66009","事故"),
    parking(8,"违章停车","201","车辆违停","66004","违章停车"),

    slow_driving(9,"缓慢行驶","0","轻度拥堵","66002","缓慢行驶"),
    super_slow_driving(10,"超慢行驶","106","超慢行驶",null,null),
    stop(11,"停驶",null,null,"66003","停驶"),
    pedestrian(12,"行人","8","行人误闯","66006","行人"),
    spill(13,"抛洒物",null,null,"66007","抛洒物"),
    fire(14,"火灾",null,null,"66008","火灾"),
    abnormal_weather(15,"异常天气",null,null,"66010","异常天气"),
    overspeed(16,"超速","103","区间超速","66011","超速"),
    overspeed2(16,"超速","107","超快行驶","66011","超速"),

    intrude(17,"闯入",null,null,"66013","闯入"),
    not_flow_lane(18,"不按车道行驶","109","不按车道行驶",null,null),
    non_motor(19,"非机动车","104","非机动车",null,null),
    danger_truck(20,"危化品车辆","100","危化品车辆",null,null),
    bus(21,"大型客车","108","大型客车",null,null),
    motor_intrude(22,"机动车闯禁行","110","机动车闯禁行","66004","违章停车"),
    nothing(99,"无",null,null,"110000","无"),
    other(100,"其他",null,null,"66014","其他");

    //融合后的事件类型编号
    public final Integer code;
    //融合后的事件类型含义
    public final String desc;
    //信路威事件类型编号
    public final String xlwCode;
    //信路威事件类型名字
    public final String xlwDesc;
    //隧道管控事件类型编号
    public final String sdgkCode;
    //隧道管控事件类型名字
    public final String sdgkDesc;

    EventTypeAllEnum(Integer code, String desc, String xlwCode, String xlwDesc, String sdgkCode, String sdgkDesc) {
        this.code = code;
        this.desc = desc;
        this.xlwCode = xlwCode;
        this.xlwDesc = xlwDesc;
        this.sdgkCode = sdgkCode;
        this.sdgkDesc = sdgkDesc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public String getXlwCode() {
        return xlwCode;
    }

    public String getXlwDesc() {
        return xlwDesc;
    }

    public String getSdgkCode() {
        return sdgkCode;
    }

    public String getSdgkDesc() {
        return sdgkDesc;
    }

    /**
     * 根据融合事件类型编号，反查事件类型枚举
     * @param code
     * @return
     */
    public static EventTypeAllEnum findByType(Integer code) {
        for (EventTypeAllEnum eventType : EventTypeAllEnum.values()) {
            if (Objects.equals(code,eventType.code)) {
                return eventType;
            }
        }
        return other;
    }

    /**
     * 根据信露威事件编号代码返回融合事件类型
     * @param xlwCode
     * @return
     */
    public static EventTypeAllEnum getByXlwCode(String xlwCode) {
        for (EventTypeAllEnum eventType : EventTypeAllEnum.values()) {
            if (Objects.equals(xlwCode,eventType.xlwCode)) {
                return eventType;
            }
        }
        return other;
    }


    /**
     * 根据隧道管控事件编号代码返回融合事件类型
     * @param sdgkCode 隧道管控编号
     * @return
     */
    public static EventTypeAllEnum getBySdgkCode(String sdgkCode) {
        for (EventTypeAllEnum eventType : EventTypeAllEnum.values()) {
            if (Objects.equals(sdgkCode,eventType.sdgkCode)) {
                return eventType;
            }
        }
        return other;
    }


}
