#pragma once

#include <QWidget>

#include "AirportModel.h"
#include "FormBuilder.h"
#include "AirportService.h"
#include "ui_AirportWidget.h"

namespace Ui { class AirportWidget; };

class AirportWidget : public QWidget
{
	Q_OBJECT

public:
	AirportWidget(QWidget *parent = Q_NULLPTR);
	~AirportWidget();

private:
	void init();
	void initTableView();
	void initModel();
	void initService();
	void initPagination();
	void initFormBuild();

	void doQuery(int pageIndex = 0);


private slots:
	void onQuery();
	void onReset();
	void onAdd();
	void onEdit();
	void onRemove();
    void onDataChange(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);

private:
	Ui::AirportWidget *ui;
	AirportModel *m_Model;
    FormBuilder *m_FormBuilder;
	AirportService *m_Service;
	int m_PageIndex;
};
