#ifndef SPELLSTABLEMODEL_H
#define SPELLSTABLEMODEL_H

#include <QAbstractTableModel>
#include "Spells.h"
#include "SpellFilter.h"

class SpellsTableModel : public QAbstractTableModel
{
    Q_OBJECT

public:
    SpellsTableModel(Spells spells, QObject *parent = nullptr);
    virtual ~SpellsTableModel();

    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;
    QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
    void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
    Spell spell(int index);
    void setSpellFilter(SpellFilter *filter);
    int rowOf(const Spell &spell) const;

private:
    Spells _spells;
    SpellFilter _filter;
};

#endif // SPELLSTABLEMODEL_H
