#ifndef HTTPUPDATEUSERPASSWORD_H
#define HTTPUPDATEUSERPASSWORD_H
#include <QThread>
#include <QtQml/qqml.h>

class HttpUpdateUserPassword : public QThread
{
    Q_OBJECT
    QML_NAMED_ELEMENT(HttpUpdateUserPassword)

    Q_PROPERTY(QString oldPassword READ oldPassword WRITE setOldPassword)
    Q_PROPERTY(QString newPassword READ newPassword WRITE setNewPassword)
public:
    explicit HttpUpdateUserPassword(QObject *parent = nullptr);

    QString oldPassword() const {
        return m_oldPassword;
    }
    void setOldPassword(const QString& oldPassword) {
        m_oldPassword = oldPassword;
    }

    QString newPassword() const {
        return m_newPassword;
    }
    void setNewPassword(const QString& newPassword) {
        m_newPassword = newPassword;
    }
protected:
    void run() override;
private:
    void httpRequestUpdatePassword(void);
public slots:
    void slotHttpResponseUpdatePassword(QByteArray data);
signals:
    void signalPutRequestData(quint64 id, QString postUrl, QByteArray data, QByteArray file, QString token);
    void signalUpdatePasswordReturnStat(int stat, QString str);
private:
    QString m_oldPassword;
    QString m_newPassword;
};

#endif // HTTPUPDATEUSERPASSWORD_H
