/****************************************************************************
**
** Copyright (C) 2012 Róbert Márki
**
** This file is part of Web Feeds.
**
** Web Feeds is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Web Feeds is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Web Feeds.  If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/

#ifndef GOOGLEREADERITEM_H
#define GOOGLEREADERITEM_H
#include "pageitem.h"
#include "googlereaderenum.h"

namespace GoogleReader
{
class GoogleReaderItem : public PageItem
{
    Q_OBJECT
    Q_PROPERTY(ItemType itemType READ itemType NOTIFY itemTypeChanged)
    Q_PROPERTY(bool editingBusy READ editingBusy WRITE setEditingBusy NOTIFY editingBusyChanged)
    Q_ENUMS(ItemType)
public:
    enum ItemType
    {
        ItUndefinedType,
        ItRootItem,
        ItFeedItem,
        ItTagItem,
        ItFolderItem,
        ItEverythingTagItem,
        ItStarredTagItem,
        ItStoryItem
    };
    explicit GoogleReaderItem(PageItemPtr parent = PageItemPtr(), AbstractFeedAggreagatorService* service = 0);
    virtual GoogleReaderItem::ItemType itemType() const;
    bool editingBusy() const;
    void setEditingBusy(bool busy);
    QString sortId() const;
    void setSortId(const QString& sortId);

private:
    ItemType m_itemType;
    bool m_editingBusy;
    QString m_sortId;

signals:
    void itemTypeChanged();
    void editingBusyChanged();
};
typedef QSharedPointer<GoogleReaderItem> GoogleReaderItemPtr;
typedef QWeakPointer<GoogleReaderItem> GoogleReaderItemWeakRef;
} // namespace GoogleReader
Q_DECLARE_METATYPE(GoogleReader::GoogleReaderItem::ItemType)

inline uint qHash(const GoogleReader::GoogleReaderItemPtr& item)
{
    return qHash(item.data());
}
#endif // GOOGLEREADERITEM_H
