/****************************************************************************
**
** 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/>.
****************************************************************************/

#include "newsbluritem.h"

namespace NewsBlur
{
/*!
  \class NewsBlurItem
  \brief The NewsBlurItem class provides a common base class for NewsBlur specific
  item types.
*/
/*!
  \enum NewsBlurItem::ItemType
  Specifies the NewsBlur specific type of the item. It can be considered as a
  description of the item's role.
  \var NewsBlurItem::ItemType UndefinedType
  Undefined item type.
  \var NewsBlurItem::ItemType RootItem
  The root item of the NewsBlur subtree.
  \var NewsBlurItem::ItemType FeedItem
  NewsBlur feed item which can only contain children with the type StoryItem.
  \var NewsBlurItem::ItemType FolderItem
  NewsBlur folder item which can only contain children with the type
  FeedItem or FolderItem.
  \var NewsBlurItem::ItemType StoryItem
  NewsBlur story item. It can't contain any child items.
  \var NewsBlurItem::ItemType StarredGroup
  NewsBlur Starred feed. It contains saved stories.
  \var NewsBlurItem::ItemType EverythingGroup
  NewsBlur Everything feed. It contains unread stories from multiple feeds.
*/
/*!
  \property NewsBlurItem::itemType
  The NewsBlur specific type of the item. \sa NewsBlurItem::ItemType
*/
/*!
  \property NewsBlurItem::feedReadBusy
  True if the operation of marking all the stories related to the item
  as read is in progress, otherwise false.
*/
/*!
  \property NewsBlurItem::movingBusy
  True if the operation of moving the item to a different folder is in
  progress, otherwise false.
*/
/*!
  \property NewsBlurItem::deletingBusy
  True if the operation of deleting the item is in progress, otherwise false.
*/

/*!
  Constructs a NewsBlurItem object with the given \a parent and \a service object.
*/
NewsBlurItem::NewsBlurItem(PageItemPtr parent, AbstractFeedAggreagatorService* service) :
    PageItem(parent, service),
    m_feedReadBusy(false),
    m_movingBusy(false),
    m_deletingBusy(false)
{
    qRegisterMetaType<NewsBlurEnum::ClassifierValue>("NewsBlurEnum::ClassifierValue");
}

NewsBlurItem::ItemType NewsBlurItem::itemType() const
{
    return NewsBlurItem::UndefinedType;
}

bool NewsBlurItem::feedReadBusy() const
{
    return m_feedReadBusy;
}

void NewsBlurItem::setFeedReadBusy(bool busy)
{
    m_feedReadBusy = busy;
    emit feedReadBusyChanged();
}

bool NewsBlurItem::movingBusy() const
{
    return m_movingBusy;
}

void NewsBlurItem::setMovingBusy(bool busy)
{
    m_movingBusy = busy;
    emit movingBusyChanged();
    emit dataChanged(NewsBlurItemWeakRef(this));
}

bool NewsBlurItem::deletingBusy() const
{
    return m_deletingBusy;
}

void NewsBlurItem::setDeletingBusy(bool busy)
{
    m_deletingBusy = busy;
    emit deletingBusyChanged();
    emit dataChanged(NewsBlurItemWeakRef(this));
}
} // namespace NewsBlur
