#ifndef THINGSBOARDINTERFACE_H
#define THINGSBOARDINTERFACE_H

class CChaletDevice;

#include <QObject>
#include <QNetworkAccessManager>
#include "ChaletData.h"

class CThingsBoardInterface : public QObject
{
    Q_OBJECT
public:
    CThingsBoardInterface();
    ~CThingsBoardInterface();

    CChaletDevice *mChaletLoraDevice;

    int RegisterThingsboardRPC();
    void UpdateChaletVoltage(float Voltage);
    void UpdateChaletData(quint8 mInverterRelayStatus, quint8 mWiFiModuleStatus, qint8 mCurrentSensorStatus, float mBatteryVoltage, qint16 mBatteryCurrent, qint16 mBatterySOC, qint8 LoraState);
    void UpdateChaletData(CChaletMainStatus *Data);

private:
    QNetworkAccessManager *mThingsBoardSocket, *mThingsBoardRPCSocket;
    QNetworkReply *mThingsBoardRPCReply;

public slots:
    void ThingsBoardServerFinished(QNetworkReply*);
    void sslErrors(QNetworkReply*,QList<QSslError>);

    void ThingsBoardRPCFinished(QNetworkReply*);
    void RPCsslErrors(QNetworkReply*,QList<QSslError>);

    void RPCData();
};

#endif // THINGSBOARDINTERFACE_H
