#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "naivebayes.h"
#include "splittingmethod.h"
#include "id3.h"
#include "randomforest.h"
#include "ibk.h"

namespace Ui {
class MainWindow;
}

/**
 * @brief The MainWindow class holds slots and function for running whole program
 * @autor Jakub Srom
 * @required naivebayes.h, randomforest.h, id3.h, randomforest.h, ibk.h
 */
class MainWindow : public QMainWindow, public MinMax
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    std::vector <std::vector<std::string> > Data;

private slots:

    void on_browse_clicked();

    void on_Algoritms_activated(const QString &arg1);

    void on_PercentageSplit_clicked();

    void on_CrossValidation_clicked();

    void on_UseTrainingSet_clicked();

    void on_run_clicked();

    void on_saveResults_clicked();

    void on_actionGeneral_triggered();

    void on_actionAbout_2_triggered();

    void on_actionNaive_Bayes_triggered();

    void on_actionIB1_triggered();

    void on_actionIBk_triggered();

    void on_actionID3_triggered();

    void on_actionRandom_Forest_triggered();

    void on_actionUse_Training_Set_triggered();

    void on_actionCross_Validation_triggered();

    void on_actionPercentage_Split_triggered();

private:
    Ui::MainWindow *ui;

    void fillVector(std::string fileName);

    int numberOfInstances();
    int numberOfAtributes();

    double sumColumn(std::vector < std::vector<std::string> > Data, int column);

    std::vector < std::vector<std::string> > handleMissingValues(std::vector < std::vector<std::string> > Data);
    std::vector < std::vector<std::string> > discretize(std::vector < std::vector<std::string> > Data, int numberOfClasses);

    std::map <std::string, double> countClassesPercantage(std::vector < std::vector<std::string> > Data);

    void Results(std::vector <std::string> testToCompare, std::vector <std::string> pomTest, int nTime);

    void copyAndOpenFile(QString fileName);

};

#endif // MAINWINDOW_H
