/**
 *
 *  gsd_HttpPlugin.h
 *
 */

#pragma once

#include <drogon/plugins/Plugin.h>
#include "config.hpp"
#include "HttpClient.h"
#include "dataTypeList.h"

namespace gsd
{

class HttpPlugin : public drogon::Plugin<HttpPlugin>
{
  public:
    HttpPlugin() {}
    /// This method must be called by drogon to initialize and start the plugin.
    /// It must be implemented by the user.
    virtual void initAndStart(const Json::Value &config) override;

    /// This method must be called by drogon to shutdown the plugin.
    /// It must be implemented by the user.
    virtual void shutdown() override;

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

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

    /**
     * @description: 获取httpInfo
     * @return {*}
     */    
    void getHttpInfo();
    
  private:
    // http
    std::shared_ptr<HttpClient> m_httpClient = nullptr;

    // timer
    Timer::Ptr timer0;
};

}
