#ifndef CATEGORYITEM_H
#define CATEGORYITEM_H

#include <QObject>
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
#include <QtQml/qqml.h>
#endif

class CategoryItemPrivate;
class CategoryItem : public QObject
{
    Q_OBJECT
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
    QML_ELEMENT
#endif
    Q_PROPERTY(int category READ category WRITE setCategory NOTIFY categoryChanged)
    Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
    Q_PROPERTY(QString normalIcon READ normalIcon WRITE setNormalIcon NOTIFY normalIconChanged)
    Q_PROPERTY(QString clickIcon READ clickIcon WRITE setClickIcon NOTIFY clickIconChanged)
    Q_PROPERTY(int pageCount READ pageCount WRITE setPageCount NOTIFY pageCountChanged)

public:
    enum Category {
        All,
        Android,
        Network,
        Messaging,
        Audio,
        Development,
        Graphics,
        Game,
        Office,
        Education,
        System,
        Other
    };
    Q_ENUM(Category)

    explicit CategoryItem(QObject *parent = nullptr);
    ~CategoryItem();

    int category() const;
    void setCategory(const int &category);

    QString name() const;
    void setName(const QString &name);

    QString normalIcon() const;
    void setNormalIcon(const QString &icon);

    QString clickIcon() const;
    void setClickIcon(const QString &icon);

    int pageCount() const;
    void setPageCount(const int &pageCount);

    static QString categoryToString(Category category);

Q_SIGNALS:
    void categoryChanged();
    void nameChanged();
    void iconChanged();
    void normalIconChanged();
    void clickIconChanged();
    void pageCountChanged();

private:
    CategoryItemPrivate *p;
};

#endif // CATEGORYITEM_H
