#pragma once
#include <QWidget>
#include <QVBoxLayout>
#include <QFormLayout>
#include <QTableWidget>
#include <QPushButton>
#include <QLineEdit>
#include <QStackedWidget>
#include <QLabel>
#include <QObject>
#include <QMessageBox>
#include "../controllers/admin_controller/admin_controller.h"
#include "../controllers/user_controller/user_controller.h"
#include "../repository/CSVRepository.h"
#include "../repository/HTMLRepository.h"
#include "../validator/validator.h"
#include "../exceptions/exceptions.h"
#include "../domain/trench.h"
#include <memory>

class GUI
{
	private:
		std::shared_ptr<AdminController> adminController;
		std::shared_ptr<UserController> userController;
		QWidget* repoSelector;
		QWidget* mainMenu;

		QWidget* adminMenu;
		QWidget* userMenu;

		QWidget* addMenu;
		QWidget* deleteMenu;
		QWidget* updateMenu;
		QWidget* showMenu;

		QTableWidget* table;

		QVBoxLayout* repoSelectorLayout;
		QVBoxLayout* mainMenuLayout;
		QVBoxLayout* adminMenuLayout;
		QVBoxLayout* userMenuLayout;
		QFormLayout* addMenuLayout;
		QFormLayout* deleteMenuLayout;
		QFormLayout* updateMenuLayout;
		QVBoxLayout* showMenuLayout;

		QPushButton* CSVBtn;
		QPushButton* HTMLBtn;

		QPushButton* adminBtn;
		QPushButton* userBtn;

		QPushButton* addBtn;
		QPushButton* deleteBtn;
		QPushButton* updateBtn;
		QPushButton* showBtn;

		QPushButton* addingBtn;
		QPushButton* deletingBtn;
		QPushButton* updatingBtn;

		QPushButton* adminExitBtn;
		QPushButton* addExitBtn;
		QPushButton* deleteExitBtn;
		QPushButton* updateExitBtn;
		QPushButton* showExitBtn;

		QLineEdit* addSize;
		QLineEdit* addColour;
		QLineEdit* addPrice;
		QLineEdit* addQuantity;
		QLineEdit* addPhotograph;

		QLineEdit* deleteSize;
		QLineEdit* deleteColour;
		QLineEdit* deletePhotograph;

		QLineEdit* updateSize;
		QLineEdit* updateColour;
		QLineEdit* updatePrice;
		QLineEdit* updateQuantity;
		QLineEdit* updatePhotograph;

		QLabel* addSizeLabel;
		QLabel* addColourLabel;
		QLabel* addPriceLabel;
		QLabel* addQuantityLabel;
		QLabel* addPhotographLabel;

		QLabel* deleteSizeLabel;
		QLabel* deleteColourLabel;
		QLabel* deletePhotographLabel;

		QLabel* updateSizeLabel;
		QLabel* updateColourLabel;
		QLabel* updatePriceLabel;
		QLabel* updateQuantityLabel;
		QLabel* updatePhotographLabel;


		QWidget* userShowMenu;

		QPushButton* showAllBtn;
		QPushButton* openBtn;
		QPushButton* exitUserBtn;

		QVBoxLayout* userShowLayout;

		QPushButton* nextBtn;
		QPushButton* buyBtn;
		QPushButton* exitBtn;
		
		QLineEdit* userSize;

		QLabel* userSizeLabel;
		
		QPushButton* searchBtn;

		QStackedWidget* userTable;

		std::vector<Trench> userCoats;


	public:
		GUI();
		~GUI();
		void run();
};
