#ifndef MQTT_H
#define MQTT_H

#include "wifi.hpp"
#include "config.hpp"
#include <WiFi.h>
#include <PubSubClient.h>


class Mqtt {
    public:
        Mqtt(WiFiClient& wifiClient);
        void mqttSetup();
        void mqttRun();
        void mqttPublish(const char* topic, const char* payload);
    private:
        void mqttReconnect();
        static void callback(char *topic, uint8_t *payload, unsigned int length);
        PubSubClient mqttClient;
};

#endif /* MQTT_H */