#pragma once

#include <array>
#include <memory>
#include <vector>

#include <QAction>
#include <QIcon>
#include <QMainWindow>
#include <QMenu>
#include <QSystemTrayIcon>
#include <QTimer>

#include "monitor.hpp"
#include "sensor.hpp"

#include "ui_AdaptiveBrightness.h"

class MainWindow : public QMainWindow {
    Q_OBJECT

  public:
    MainWindow(QWidget* parent = nullptr);
    ~MainWindow();

  private:
    void loadIcons();

    void updateState();

    Ui::AdaptiveBrightnessClass m_ui;

    std::array<std::unique_ptr<QIcon>, 9> m_noSensorStateIcons;
    std::array<std::unique_ptr<QIcon>, 9> m_sensorStateIcons;
    std::unique_ptr<QIcon> m_errorIcon;

    bool m_visibility = false;
    QAction* m_showHideAction = nullptr;
    QMenu* m_trayIconMenu = nullptr;
    QSystemTrayIcon* m_trayIcon = nullptr;

    QTimer* m_timer = nullptr;

    float m_brightness = 0.5f;

    std::vector<Sensor> m_sensors;
    std::vector<Monitor> m_monitors;
};
