#pragma once

#include <functional>
#include <mutex>
#include <string>

namespace mqtt {

struct IncomingMessage {
    std::string topic;
    std::string payload;
    int message_type = -1;
};

class MessageRouter {
public:
    using Handler = std::function<void(const IncomingMessage &)>;

    void set_device_control_handler(Handler handler);
    void route(const std::string &topic, const std::string &payload) const;

private:
    mutable std::mutex mutex_;
    Handler device_control_handler_;
};

} // namespace mqtt
