#ifndef CHALETUBIDOTSINTERFACE_H
#define CHALETUBIDOTSINTERFACE_H

#include <QObject>
#include <QtMqtt/QtMqtt>
#include <QMqttClient>
#include "ChaletData.h"
#include <QString>

#define UBIDOTS_URL "things.ubidots.com"
#define UBIDOTS_PORT 1883

class CChaletUbidotsInterface : public QObject
{
    Q_OBJECT
public:
    explicit CChaletUbidotsInterface(QString UbidotsUsername, QObject *parent = 0);
    ~CChaletUbidotsInterface();
    virtual int LogUbidotsChaletData(CChaletMainStatus *Data);
    virtual void MQTTStateChanged(QMqttClient::ClientState)=0;

    QMqttClient *mUbidotsChaletClient;
    QString mUbidotsUsername;
    QString mInterfaceOwnerName;



public slots:
        void UbidotsStateChanged(QMqttClient::ClientState);
};

class CChaletJFUbidotsInterface: public CChaletUbidotsInterface
{
    Q_OBJECT
public:
    explicit CChaletJFUbidotsInterface(QString Username);
    virtual int LogUbidotsChaletData(CChaletMainStatus *Data);
    void MQTTStateChanged(QMqttClient::ClientState);

    QMqttSubscription *mInverterBtnSubscritption, *mWiFiBtnSubscription;

public slots:
    void InverterBtnSubscriptionMsgReceived(QMqttMessage);
    void WiFiBtnSubscriptionMsgReceived(QMqttMessage);


};
#endif // CHALETUBIDOTSINTERFACE_H
