/****************************************************************************
**
** 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 GLOBALS_H
#define GLOBALS_H
#include <QMetaType>
#include <QObject>
#include <QHash>
#include <QStringList>

namespace NewsBlur
{
class FeedClassifiers;
class NewsBlurEnum : public QObject
{
    Q_OBJECT
public:
    enum ServiceRequestError
    {
        SreNoError = 0,
        SreUndefinedError,
        SreAborted,
        SreNetworkError,
        SreInvalidReplyContents,
        SreResponseResultFalse,
        SreInvalidAccount
    };
    Q_ENUMS(ServiceRequestError)
    enum ClassificationFilter
    {
        CfNoFilter,
        CfNonNegative,
        CfOnlyPositive
    };
    Q_ENUMS(ClassificationFilter)
    enum ClassifierValue
    {
        CvUndefinedClassifierValue = -2,
        CvNegativeClassifier,
        CvNeutralClassifier,
        CvPositiveClassifier
    };
    Q_ENUMS(ClassifierValue)
    static bool filterAcceptsClassification(NewsBlurEnum::ClassificationFilter filter,
                                            NewsBlurEnum::ClassifierValue classification);
    static NewsBlurEnum::ClassifierValue classifierFromString(const QString &classifier);
    static NewsBlurEnum::ClassifierValue storyClassification(NewsBlurEnum::ClassifierValue tagClassifier,
                                                NewsBlurEnum::ClassifierValue authorClassifier,
                                                NewsBlurEnum::ClassifierValue titleClassifier,
                                                NewsBlurEnum::ClassifierValue feedClassifier);
    static NewsBlurEnum::ClassifierValue storyClassification(const FeedClassifiers& classifierSet,
                                                             const QString& storyTitle,
                                                             const QString& storyAuthor,
                                                             const QStringList& storyTags);
    static const char* s_highlightColor;
    static const char* s_negativeHighlightColor;
    static const char* s_positiveHighlightColor;
};
typedef QHash<QString, NewsBlurEnum::ClassifierValue> ClassifierHash;
} // namespace NewsBlur
Q_DECLARE_METATYPE(NewsBlur::NewsBlurEnum::ServiceRequestError)
Q_DECLARE_METATYPE(NewsBlur::NewsBlurEnum::ClassificationFilter)
Q_DECLARE_METATYPE(NewsBlur::NewsBlurEnum::ClassifierValue)
Q_DECLARE_METATYPE(NewsBlur::ClassifierHash)
#endif // GLOBALS_H
