#ifndef WPROGRAMPUBLISHITEM_H
#define WPROGRAMPUBLISHITEM_H

#include <QObject>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QDir>
#include <QDateTime>
#include <QJsonObject>
#include <QJsonDocument>
#include <QPushButton>
#include <LoQClass/loqpushbutton.h>
#include <LoQClass/loqtreewidget.h>
#include <wDevicesManager/ledcard.h>
#include <communication/hpptclient.h>
#include "threadsendpro.h"
#include <QProgressBar>
#include <QLabel>
class wProgramPublishItem : public QObject, public QTreeWidgetItem
{
    Q_OBJECT
   // Q_PROPERTY(LedCard objLedCard    MEMBER m_LedCard   NOTIFY LedCardChanged   )
public:
    explicit wProgramPublishItem(LedCard *pLedCard, LoQTreeWidget *parent = nullptr,QWidget *pWnd=nullptr,QString strProgramName="",QString strProgramPath="");
     ~wProgramPublishItem();
private:
    void init();
    QString getRandomString(int length);
    void SetPasswordItem(LedCard *p);
public:
    void refreshLable();
    QString GetLedCardId();
    void SetItemParam(LedCard *p);
    void onPublish();

signals:

public slots:
    void onAttrChanged();
    void OnProHttpResponse(QString url, QString postMD5, QByteArray data);
    void OnThreadFinished();
    void OnSendStatusTip(QString);
    void onVerifyLockPassword();
    void onInputPasswordPro(QString strPassword);

private:
    LedCard   *m_pLedCard = nullptr;
    QString m_strProgramName="";
    QString m_strProgramPath="";

private:
    QLabel *m_ImageOnline=nullptr;
    LoQTreeWidget *m_parent = nullptr;
    QString m_strUrl="";
    QWidget *m_pWnd=nullptr;
    HpptClient *pHpptClient = nullptr;
    QProgressBar *m_pProgress=nullptr;
    int m_iSendingFlag=0;
    QPushButton *m_bnLock = nullptr;//

};
enum ENUM_DEVICE_PUBLISH_HEADERITEM
{
    ENUM_DEVICE_PUBLISH_HEADE_CHECK=0,
    ENUM_DEVICE_PUBLISH_HEADE_SCREEN_ID,
    ENUM_DEVICE_PUBLISH_HEADE_ONLINE,
    ENUM_DEVICE_PUBLISH_HEADE_SCREEN_IP,
    ENUM_DEVICE_PUBLISH_HEADE_SCREEN_SIZE,
    ENUM_DEVICE_PUBLISH_HEADE_ENCRYPT,
    ENUM_DEVICE_PUBLISH_HEADE_PROGRESS,
    ENUM_DEVICE_PUBLISH_HEADE_REMARK_NAME,
    ENUM_DEVICE_PUBLISH_HEADE_REMARKS,
    ENUM_DEVICE_PUBLISH_HEADE_END,
};


#endif // WPROGRAMPUBLISHITEM_H
