#ifndef CALENDARLISTMODEL_H
#define CALENDARLISTMODEL_H

#include <QAbstractListModel>
#include <QtQmlIntegration>

class CalendarListModel : public QAbstractListModel
{
    Q_OBJECT
    QML_ELEMENT

public:
    enum Roles {
        Name = Qt::UserRole,
    };

    explicit CalendarListModel(QObject *parent = nullptr);
    ~CalendarListModel() override;

    QVariant headerData(int section,
                        Qt::Orientation orientation,
                        int role = Qt::DisplayRole) const override;

    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;

    int rowCount(const QModelIndex &parent = QModelIndex()) const override;

    QHash<int, QByteArray> roleNames() const override;

private:
    struct Calendar;

    Q_DISABLE_COPY_MOVE(CalendarListModel)

    void fetch();

    QVector<Calendar *> m_calendars;
};

#endif // CALENDARLISTMODEL_H
