/****************************************************************************
**
** 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 STORYITEM_H
#define STORYITEM_H
#include "newsbluritem.h"

namespace NewsBlur
{
class StoryItem : public NewsBlurItem
{
    Q_OBJECT
    Q_PROPERTY(bool isRead READ isRead NOTIFY readChanged)
    Q_PROPERTY(QString contents READ contents NOTIFY contentsChanged)
    Q_PROPERTY(QString url READ url NOTIFY urlChanged)
    Q_PROPERTY(bool starred READ isStarred NOTIFY starredChanged)
    Q_PROPERTY(bool starredBusy READ isStarredBusy WRITE setStarredBusy NOTIFY starredBusyChanged)
    Q_PROPERTY(QDateTime date READ date)
    Q_PROPERTY(QString formattedDate READ formattedDate)
    Q_PROPERTY(QString formattedDateTime READ formattedDateTime)
    Q_PROPERTY(int feedId READ feedId)
    Q_PROPERTY(QStringList tags READ tags)
    Q_PROPERTY(QString author READ author)
    Q_PROPERTY(int itemClassification READ itemClassification NOTIFY itemClassificationChanged)
public:
    explicit StoryItem(PageItemPtr parent = PageItemPtr(), AbstractFeedAggreagatorService* service = 0);
    
    NewsBlurItem::ItemType itemType() const;
    bool isRead() const;
    void setRead(bool read);
    void setReadWithoutNotify(bool read);
    QString contents() const;
    void setContents(const QString& contents);
    QString url() const;
    void setUrl(const QString& url);
    bool isStarred() const;
    void setStarred(bool starred);
    bool isStarredBusy() const;
    void setStarredBusy(bool busy);
    QDateTime date() const;
    void setDate(const QDateTime& date);
    QString formattedDate() const;
    QString formattedDateTime() const;
    int feedId() const;
    void setFeedId(int feedId);
    QStringList tags() const;
    void setTags(const QStringList& tags);
    QString author() const;
    void setAuthor(const QString& authors);
    int itemClassification() const;
    void setItemClassification(int classification);

private:
    bool m_read;
    QString m_contents;
    QString m_url;
    bool m_starred;
    bool m_starredBusy;
    QDateTime m_date;
    QString m_fromattedDate;
    QString m_formattedDateTime;
    int m_feedId;
    QStringList m_tags;
    QString m_author;
    NewsBlurEnum::ClassifierValue m_itemClassifier;

signals:
    void readChanged();
    void contentsChanged();
    void urlChanged();
    void starredChanged();
    void starredBusyChanged();
    void itemClassificationChanged();
    void feedTitleChanged();
};
typedef QSharedPointer<StoryItem> StoryItemPtr;
typedef QWeakPointer<StoryItem> StoryItemWeakRef;
} // namespace NewsBlur
#endif // STORYITEM_H
