/*
DO NOT MODIFY THIS FILE.  It is automatically generated and changes will be over-written
on the next generation.

It contains enumerations used by the {{stinger.name}} interface.
*/


#pragma once

#include <cstdint>
#include <functional>
#include <map>
#include <string>
#include <memory>
#include <exception>
#include <mutex>
#include <boost/optional.hpp>
#include <rapidjson/document.h>

#include "ibrokerconnection.hpp"
#include "{{stinger.cpp.enum_header_file}}"
#include "return_types.hpp"

class {{stinger.cpp.server_class_name}} {

public:
    static constexpr const char NAME[] = "{{stinger.name}}";
    static constexpr const char INTERFACE_VERSION[] = "{{stinger.version}}";

    {{stinger.cpp.server_class_name}}(std::shared_ptr<IBrokerConnection> broker);

    virtual ~{{stinger.cpp.server_class_name}}() = default;

    {%for sig_name, sig in stinger.signals.items()%}
    boost::future<bool> emit{{sig_name | UpperCamelCase}}Signal({%for arg in sig.arg_list%}{{arg.cpp_type}}{%if not loop.last%}, {%endif%}{%endfor%});
    {%endfor%}

    {%for method_name, method in stinger.methods.items()%}
    void register{{method_name | UpperCamelCase}}Handler(std::function<{{method.return_value_cpp_class}}({%for arg in method.arg_list%}{{arg.cpp_type}}{%if not loop.last%}, {%endif%}{%endfor%})> func);
    {%endfor%}
private: 
    std::shared_ptr<IBrokerConnection> _broker;
    void _receiveMessage(const std::string& topic, const std::string& payload, const boost::optional<std::string> optCorrelationId, const boost::optional<std::string> optResponseTopic);

    {%for method_name, method in stinger.methods.items()%}
    void _call{{method_name | UpperCamelCase}}Handler(const std::string& topic, const rapidjson::Document& doc, boost::optional<std::string> clientId, boost::optional<std::string> correlationId) const;
    std::function<{{method.return_value_cpp_class}}({%for arg in method.arg_list%}{{arg.cpp_type}}{%if not loop.last%}, {%endif%}{%endfor%})> _{{method_name | camelCase}}Handler;
    {%endfor%}

};