#pragma once

#include <drogon/HttpController.h>
#include <drogon/drogon.h>

using namespace drogon;

namespace api
{
namespace v1
{
class apps : public drogon::HttpController<apps>
{
  public:
    METHOD_LIST_BEGIN
      // use METHOD_ADD to add your custom processing function here;
      METHOD_ADD(apps::getTemplate, "/template?token={1}&name={2}", Get, "LoginFilter"); // path is /api/v1/apps/template?token={1}
      METHOD_ADD(apps::getAIList, "AIList?token={1}", Get, "LoginFilter");

      METHOD_ADD(apps::getAI, "AI?token={1}&name={2}", Get, "LoginFilter");
      METHOD_ADD(apps::postAI, "AI?token={1}&name={2}&uri={3}", Post, "LoginFilter");
      METHOD_ADD(apps::deleteAI, "AI?token={1}&name={2}", Delete, "LoginFilter");
      
    METHOD_LIST_END
    // your declaration of processing function maybe like this:
    void getTemplate(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, std::string token, std::string name);
    void getAIList(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, std::string token);

    // AI
    void getAI(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, std::string token, std::string name);
    void postAI(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, std::string token, std::string name, std::string uri);
    void deleteAI(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, std::string token, std::string name);
};
}
}
