/****************************************************************************
**
** 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 "updatetreereply.h"

namespace NewsBlur
{
/*!
  \class UpdateTreeReply
  \brief The UpdateTreeReply class represents the reply
  of the NewsBlur server for a NewsBlurClient::TpUpdateTree
  request.

  The reply contains all the information necessary
  to contruct the initial tree structure of the feeds and folders
  for the given user account.
*/

/*!
  Constructs a UpdateTreeReply object.
*/
UpdateTreeReply::UpdateTreeReply()
    : NewsBlurReply(),
      m_rootItem(new PageItem),
      m_everythingGroup(0),
      m_starredGroup(0),
      m_starredStoryCount(0)
{
}

/*!
  Returns NewsBlurReply::RlUpdate.
*/
WebServiceReply::Role UpdateTreeReply::role() const
{
    return WebServiceReply::RlUpdate;
}

/*!
  Returns the root item of the service.
*/
PageItemPtr UpdateTreeReply::rootItem()
{
    return m_rootItem;
}

/*!
  Returns the item representing the Everything feed.
*/
EverythingGroupPtr UpdateTreeReply::everythingGroup() const
{
    return m_everythingGroup;
}

/*!
  Returns the item representing the Saved stories feed.
*/
StarredGroupPtr UpdateTreeReply::starredGroup() const
{
    return m_starredGroup;
}

/*!
  Returns every feed item the user is subscribed to.
  Multiple feed items can exist for the same feed if they
  have different parent folders.
*/
QMultiHash<int, FeedItemPtr> UpdateTreeReply::feedItems() const
{
    return m_feedItems;
}

/*!
  Returns the list of folder items the user created.
*/
QList<FolderItemPtr> UpdateTreeReply::folderItems() const
{
    return m_folderItems;
}

/*!
  Returns the icons for the feeds the user is subscibed to.
*/
QHash<QString, QImage> UpdateTreeReply::feedFavicons() const
{
    return m_feedFavicons;
}

/*!
  Returns the number of starred or saved stories.
*/
int UpdateTreeReply::starredStoryCount() const
{
    return m_starredStoryCount;
}

/*!
  Returns the list of feed ids, for which the retrieving of
  their favicons were denied.
*/
QStringList UpdateTreeReply::ignoredFavicons() const
{
    return m_ignoredFavicons;
}
} // namespace NewsBlur
