#pragma once

#include <QAbstractTableModel>
#include "qsacnuniverse.h"

class UniverseModel
    : public QAbstractTableModel
{
    Q_OBJECT

public:
    /// @brief The data_modes enum
    enum data_modes {
        Decimal,
        Hex,
        Percent
    };
    Q_ENUM(data_modes)

    explicit UniverseModel(QObject *parent = nullptr);

    // Model overrides:
    QVariant headerData(int section, Qt::Orientation orientation,
                        int role = Qt::DisplayRole) const override;
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    int columnCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index,
                  int role = Qt::DisplayRole) const override;
    bool setData(const QModelIndex &index, const QVariant &value,
                 int role = Qt::EditRole) override;
    Qt::ItemFlags flags(const QModelIndex& index) const override;

    // Data source:
    void setUniverse(QSacnUniverse* universe);
    data_modes dataMode();

signals:
    void recievedUpdate(QSacnUniverse*);

public slots:
    void universeRefreshed();
    void setDataMode(const QString mode);

private:
    QSacnUniverse* universe_;
    data_modes data_mode_;
};
