#ifndef FILEFILTERMODEL_H
#define FILEFILTERMODEL_H

#include <QAbstractItemModel>

class FileFilterModel : public QAbstractItemModel
{
    Q_OBJECT
signals:
    void node(QIcon, QString);
    void root(QModelIndex);
    void recovery(QList<void *> hiddens, QList<void *> brokens, QList<void *> replaces);
public:
    explicit FileFilterModel(QObject *parent = nullptr);

    // Header:
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
    bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override;

    // Basic functionality:
    QModelIndex index(int row, int column,
                      const QModelIndex &parent = QModelIndex()) const override;
    QModelIndex parent(const QModelIndex &index) 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;

public:
    int filtered();
    void addFilterNode(void *);
    void addFilterData(int, void *);
    void updateIndex(int idx) { m_iIndex = idx; root(createIndex(idx, 0, m_oRoots.at(idx))); }
    void recovery(/*QModelIndexList idxes = QModelIndexList()*/);
    QList<void *> recoveryHiddenData(int, int);
    QList<void *> recoveryBrokenData(int, int);
    QList<void *> recoveryRepleaceData(int, int);
public slots:
    void deleteFilterNode(int);
    void showRules();
private:
    int            m_iIndex;
    QList<void *>  m_oRoots;
    QStringList    m_oHeaders;
};

#endif // FILEFILTERMODEL_H
