#ifndef DEVICE_CTRL_DEVICE_GROUP_H
#define DEVICE_CTRL_DEVICE_GROUP_H
#include "loadometer/loadometer.h"
#include "spkbox/spkbox.h"
#include "vidicon/vidicon.h"
#include "wbs/wbs_config.pb.h"
#include "ytj/ytj.h"

namespace zsy
{
    // class Ytj;
    // class Loadometer;
    // class Spkbox;
    // class Vidicon;

    class DeviceGroup
    {
        enum class DeviceType
        {
            BARRIER,
            VIDICON,
            SPKBOX,
            LOADOMETER,
        };

        DeviceGroupConfig config;

        std::unordered_map<std::string, std::shared_ptr<Vidicon> > vidicons;
        std::unordered_map<std::string, std::shared_ptr<Spkbox> > spkboxes;
        std::shared_ptr<Loadometer> loadometer;
        std::unordered_map<std::string, std::shared_ptr<Ytj> > barriers;
        std::unordered_map<std::string, std::unordered_map<DeviceType, std::string> > associations;

    public:
        explicit DeviceGroup(const DeviceGroupConfig &config);

        /**
         * 获取摄像机
         */
        std::shared_ptr<Vidicon> getVidicon(const std::string &barrierSn) const;

        /**
         * 获取音柱
         */
        std::shared_ptr<Spkbox> getSpkbox(const std::string &barrierSn) const;

        /**
         * 获取地磅
         */
        std::shared_ptr<Loadometer> getLoadometer(const std::string &barrierSn) const;

        /**
         * 获取道闸
         */
        std::shared_ptr<Ytj> getBarrier(const std::string &barrierSn) const;

        ~DeviceGroup() = default;
    };
} // zsy

#endif //DEVICE_CTRL_DEVICE_GROUP_H