/**
 *
 *  httpHelper.h
 *
 */

#pragma once

#include <drogon/plugins/Plugin.h>
#include <drogon/drogon.h>

using namespace drogon;

class httpHelper : public drogon::Plugin<httpHelper>
{
  public:
    httpHelper() {}
    /// 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: 构建错误回复
     * @param {string} data
     * @return {*}
     */    
    HttpResponsePtr makeWrongReply(std::string data);

    /**
     * @description: 应答回复
     * @param {pair<ReqResult, HttpResponsePtr>} result
     * @return {*}
     */    
    HttpResponsePtr replyRequest(std::pair<ReqResult, HttpResponsePtr> result, const HttpMethod method);
};

