#pragma once

#include <graph/server/gui/chart/chart.h>
#include <graph/server/plugin.h>
#include <QFileDialog>
#include <QMainWindow>
#include <QMenuBar>
#include <QStatusBar>
#include <QToolBar>
#include <vector>

namespace Ui {
class MainWindow;
}

namespace Graph::GUI {
class MainWindow : public QMainWindow {
  Q_OBJECT
 private:
  explicit MainWindow(QWidget* parent = nullptr, int argc = 0, char** argv = nullptr);

 public:
  MainWindow(MainWindow& other) = delete;
  void operator=(const MainWindow&) = delete;
  ~MainWindow();

  static MainWindow* getInstance(int argc, char** argv);
  static MainWindow* getInstance();
  static void close();

  void addData(unsigned int chartIndex, const char* seriesName, const point_t* points, unsigned long count);

  void removeChart(ChartWidget* chartWidget);

 private slots:
  void on_action_Add_triggered();
  void on_action_Load_triggered();

 private:
  static MainWindow* instance;
  Ui::MainWindow* ui;

  PluginModel* pluginModel;
  std::vector<ChartWidget*> charts;

  QFileDialog* fileDialog;

  int argc;
  char** argv;
};
} // namespace Graph::GUI
