{{>licenseInfo}}
#ifndef {{prefix}}_OBJECT_H
#define {{prefix}}_OBJECT_H

#include "{{prefixLowerCase}}{{packageNameLowerCase}}commonexports.h"

#include <QtCore/qjsonvalue.h>
#include <QtCore/qstring.h>

#include <memory>

{{#buildingQtSources}}
QT_BEGIN_NAMESPACE
{{/buildingQtSources}}

{{#cppCommonNamespaceDeclarations}}
namespace {{this}} {
{{/cppCommonNamespaceDeclarations}}

class {{prefix}}ObjectPrivate;

class {{packageNameUpperCase}}_COMMON_EXPORT {{prefix}}Object {
public:
    {{prefix}}Object();
    {{prefix}}Object(const {{prefix}}Object &other);
    {{prefix}}Object &operator=(const {{prefix}}Object &other);
    {{prefix}}Object({{prefix}}Object &&) noexcept;
    {{prefix}}Object &operator=({{prefix}}Object &&) noexcept;
    virtual ~{{prefix}}Object();

    virtual QJsonValue asJsonValue() const;
    virtual QString asJson() const;
    virtual void fromJson(const QString &jsonString);
    virtual void fromJsonValue(const QJsonValue &json);
    virtual bool isSet() const;
    virtual bool isValid() const;

private:
    friend bool operator==(const {{prefix}}Object &lhs, const {{prefix}}Object &rhs)
    { return lhs.asJsonValue() == rhs.asJsonValue(); }
    friend bool operator!=(const {{prefix}}Object &lhs, const {{prefix}}Object &rhs)
    { return !operator==(lhs, rhs); }

    friend size_t qHash(const {{prefix}}Object &obj, size_t seed)
    { return qHash(obj.asJsonValue(), seed); }
    friend size_t qHash(const {{prefix}}Object &obj)
    { return qHash(obj, 0); }

private:
    // Note that d_ptr refers to QObjectPrivate, which we cannot use because
    // we do not want to link to CorePrivate
    friend class {{prefix}}ObjectPrivate;
    std::unique_ptr<{{prefix}}ObjectPrivate> d;
};

{{#cppCommonNamespaceDeclarations}}
} // namespace {{this}}
{{/cppCommonNamespaceDeclarations}}

{{#buildingQtSources}}
QT_END_NAMESPACE
{{/buildingQtSources}}

#endif // {{prefix}}_OBJECT_H
