package com.usky.fire.service.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yq
 * @date 2021/12/31 11:11
 */
public enum TopListener {

    /**
     * 城运对接
     */
    MH_WATER_INFO("fireInfo","mh/water/info",1),
    MH_WATER_ALERT("fireInfo","mh/water/alert",1),
    MH_WATER_STATISTICS("fireInfo","mh/water/statistics",1),
    DEVICE_INFO("fireInfo","device/info",1),
    DEVICE_ALERT("fireInfo","device/alert",1),
    DEVICE_DETAIL("fireInfo","device/detail",1),
    DEVICE_AJ("fireInfo","device/aj",1),

    /**
     * 全部设备对接
     */
    FIRE_INFO("fireInfo","/usky/ytDP0001/+/+/info",1),
    FIRE_ALERT("fireAlarm","/usky/ytDP0001/+/+/alarm",1),
    WATER_INFO("waterInfo","/usky/ytDP0002/+/+/info",1),
    WATER_ALERT("waterAlert","/usky/ytDP0002/+/+/alarm",1),
    SMOKE_INFO("smokeInfo","/usky/ytDP0003/+/+/info",1),
    SMOKE_ALERT("smokeAlarm","/usky/ytDP0003/+/+/alarm",1),
    LIQUID_INFO("waterInfo","/usky/ytDP0005/+/+/info",1),
    LIQUID_ALERT("waterAlert","/usky/ytDP0005/+/+/alarm",1),
    RTU_INFO("rtuinfo","/usky/ytDP0006/+/+/info",1),
    RTU_ALERT("rtuAlert","/usky/ytDP0006/+/+/alarm",1),
    ELECTRICAL_INFO("electricalInfo","/usky/ytDP0007/+/+/info",1),
    ELECTRICAL_ALERT("electricalAlarm","/usky/ytDP0007/+/+/alarm",1),
    MH_COVER_INFO("waterInfo","/usky/ytDP0008/+/+/info",1),
    MH_COVER_ALERT("waterAlert","/usky/ytDP0008/+/+/alarm",1),
    VIDEO_ALERT("videoAlert","/usky/ytCamCore/+/+/alarm",1),
    LR_SMOKE_INFO("smokeInfo","/usky/ytDP00033/+/+/info",1),
    LR_SMOKE_ALERT("smokeAlarm","/usky/ytDP00033/+/+/alarm",1);




    private String name;
    private String code;
    //0发送队列，1监听队列2都是
    private Integer type;

    TopListener(String name, String code, Integer type){
        this.name = name;
        this.code = code;
        this.type = type;
    }

    public static TopListener parse(String code){
        TopListener topListener = null;
        for (TopListener t:TopListener.values()) {
            if (t.getCode().equals(code)){
                topListener = t;
                break;
            }
        }
        return topListener;
    }
    public static List<TopListener> parse(Integer type){
        List<TopListener> listeners = new ArrayList<>();
        for (TopListener t:TopListener.values()) {
            if (t.getType().equals(type)){
                listeners.add(t);
            }
        }
        return listeners;
    }
    public String getCode(){
        return code;
    }
    public String getName(){
        return name;
    }
    public Integer getType(){
        return type;
    }
}
