#ifndef __HTTPPLUGIN_HPP_
#define __HTTPPLUGIN_HPP_

#include <iostream>
#include "UtilBase.hpp"
#include "Util/logger.h"
#include "config.hpp"
#include "HttpClient.hpp"
#include "HttpServer.hpp"
#include "requests.hpp"
#include "ExpelDevice.h"
#include "InfineFilter.hpp"
#include "PluginSubscriber.hpp"

using namespace std;
using namespace toolkit;

namespace gsd
{
    class HttpPlugin: public PluginSubscriber<HttpPlugin>, public PluginBase
    {
    private:
        HttpPlugin(){
        }

    public:

        using Ptr = std::shared_ptr<HttpPlugin>;

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

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

        /**
         * @description: 启动任务
         * @return {*}
         */        
        bool StartTask();

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

        /**
         * @description: 获取数据
         * @return {*}
         */        
        void getHttpInfo();

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

        /**
         * @description: 纠察器
         * @param {string&} ImageBase64
         * @param {string&} datas
         * @return {*}
         */        
        std::pair<bool, std::string> getCheck(std::string& ImageBase64, std::string& datas);

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

        ~HttpPlugin(){}

    protected:  
        std::shared_ptr<HttpClient> m_httpClient = nullptr;
        std::shared_ptr<HttpServer> m_HttpServer = nullptr;
        // timer
        Timer::Ptr timer0;
    };
} // namespace gsd


















#endif