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

class HttpUpdateUserInfo : public QThread
{
    Q_OBJECT
    QML_NAMED_ELEMENT(HttpUpdateUserInfo)

    Q_PROPERTY(QString nickname READ nickname WRITE setNickname);
    Q_PROPERTY(QString email READ email WRITE setEmail);
    Q_PROPERTY(QString mobile READ mobile WRITE setMobile);
    Q_PROPERTY(int sex READ sex WRITE setSex);
    Q_PROPERTY(QString avatar READ avatar WRITE setAvatar);
public:
    explicit HttpUpdateUserInfo(QObject *parent = nullptr);

    QString nickname() {
        return m_nickname;
    }
    void setNickname(const QString& nickname) {
        m_nickname = nickname;
    }

    QString email() {
        return m_email;
    }
    void setEmail(const QString& email) {
        m_email = email;
    }

    QString mobile() {
        return m_mobile;
    }
    void setMobile(const QString& mobile) {
        m_mobile = mobile;
    }

    int sex() {
        return m_sex;
    }
    void setSex(int sex) {
        m_sex = sex;
    }

    QString avatar() {
        return m_avatar;
    }
    void setAvatar(const QString& avatar) {
        m_avatar = avatar;
    }
protected:
    void run() override;
private:
    void httpRequestUpdateUserInfo(void);
public slots:
    void slotHttpResponseUpdateUserInfo(QByteArray data);
signals:
    void signalPutRequestData(quint64 id, QString postUrl, QByteArray data, QByteArray file, QString token);
    void signalUpdateUserInfoReturnStat(int stat, QString str);
private:
    QString m_avatar;
    QString m_email;
    QString m_mobile;
    QString m_nickname;
    int m_sex;
};
#endif // HTTPUPDATEUSERINFO_H
