#pragma once

#include <string>
#include <mqtt/async_client.h>

class MqttClient
{
public:
    MqttClient(const std::string &configPath);
    bool start();

private:
    std::string broker;
    std::string clientId;
    std::string username;
    std::string password;
    std::string topic;
    int qos;

    class Callback : public virtual mqtt::callback
    {
    public:
        void message_arrived(mqtt::const_message_ptr msg) override;
    };

    mqtt::async_client *client = nullptr;
    mqtt::connect_options connOpts;
    Callback callback;
};
