#ifndef BLASTRECORD_H
#define BLASTRECORD_H

#include <QWidget>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonDocument>
#include <QStandardItemModel>
#include <QUrl>
#include "../httpclient.h"
#include "../global.h"
#include "../PageWidget.h"
#include "../global.h"
#include "hblastrecorddao.h"
namespace Ui {
class BlastRecord;
}

class BlastRecord : public QWidget
{
    Q_OBJECT

public:
    explicit BlastRecord(QWidget *parent = nullptr);
    ~BlastRecord();

private:
    void parseJsonString(const QJsonDocument& jsonDoc);
    void dataTable( const QJsonDocument& jsonDoc);
    void loadDataFromSource(int currentPage, int pageSize);
    void loadAndRefreshData();
    void PageChanged(int page);
    void onComboBoxIndexChanged(int index);
    QList<QStandardItem*> jsonToItem(const QJsonObject& jsonObj);

private:
    Ui::BlastRecord *ui;
    PageWidget *m_pPageWidget;
    int pageSize;  //每页显示的记录数量
    int currentPage;      //当前页面
    int totalCount;
    HBlastRecordDao dao;
    HttpClient *m_httpClient;
    QStandardItemModel *model;
    QJsonArray dataArray;
};

#endif // BLASTRECORD_H
