#ifndef __MONITORPLUGIN_HPP_
#define __MONITORPLUGIN_HPP_

#include <iostream>
#include "UtilBase.hpp"
#include "requests.hpp"
#include "Monitor.hpp"
#include "HttpClient.hpp"
#include "TcpPlugin.hpp"
#include "InfineFilter.hpp"
#include "HttpPlugin.hpp"
#include "PluginSubscriber.hpp"

using namespace std;

namespace gsd
{
    class MonitorPlugin: public PluginSubscriber<MonitorPlugin>, public PluginBase 
    {
    private:
        MonitorPlugin(): PluginBase(){
        }
    public:
        using Ptr = std::shared_ptr<MonitorPlugin>;
        
        ~MonitorPlugin(){}

        /**
         * @description: getPtr
         * @return {*}
         */        
        static std::shared_ptr<MonitorPlugin> getPtr();

        /**
         * @description: 初始化
         * @return {*}
         */        
        virtual bool Init();

        /**
         * @description: StartTask
         * @return {*}
         */        
        virtual bool StartTask();

        /**
         * @description: 释放
         * @return {*}
         */        
        virtual void Destroy();

        /**
         * @description: 
         * @return {*}
         */        
        virtual bool Alive(); 

        /**
         * @description: 处理数据的进程
         * @return {*}
         */    
        void MonitorProThrd();

        /**
         * @description: 消费数据
         * @param {Ptr&} result
         * @return {*}
         */    
        bool ConsumeData(FrameInferData::Ptr& result);

        /**
        * @description: 保存视频记录
        * @param {HistoryVideo&} historyVideo
        * @return {*}
        */
        bool SaveVideoRecord(HistoryVideo& historyVideo);

        /**
         * @description: RestPlugin
         * @return {*}
         */        
        virtual bool RestPlugin();

    private:
        std::shared_ptr<Monitor> monitor = nullptr;
        std::shared_ptr<ThreadPool> pool = nullptr;
        bool stop_ = false;
    };
} // namespace gsd












#endif