#ifndef WINDOW_H
#define WINDOW_H

#include <QWidget>
#include "cell.h"
class QSpacerItem;
class QHBoxLayout;
class QVBoxLayout;
class QGridLayout;
class QPushButton;
class QSlider;
class Window : public QWidget
{
    Q_OBJECT
public:
    explicit Window(QWidget *parent = nullptr);

private:
    QPushButton *clearButton;
    QPushButton *solveButton;
    QSlider *slider;
    std::array<Cell, 81> grid;
    int delayTime = 300;
    QSpacerItem *spacer[3];
    QHBoxLayout *horizontalLayout;
    QVBoxLayout *verticalLayout;
    QGridLayout *layout;
    struct History
    {
        Cell *cell;
        std::array<int, 9> blocked;
        History(Cell *c, int choice)
        {
            cell = c;
            blocked = c->blocked;
            blocked[choice]++;
        }
    };
    inline void delay();

private slots:
    void setValue(int s);
    void solveButtonClicked();
    void clearButtonClicked();
};

#endif // WINDOW_H