/**
 * OpenAPI Petstore
 * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
 *
 * The version of the OpenAPI document: 1.0.0
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

#ifndef PFX_OBJECT_H
#define PFX_OBJECT_H

#include <QJsonDocument>
#include <QJsonObject>
#include <QMetaType>

namespace test_namespace {

class PFXObject {
public:
    PFXObject() {}

    PFXObject(QString jsonString) {
        fromJson(jsonString);
    }

    virtual ~PFXObject() {}

    virtual QJsonObject asJsonObject() const {
        return jObj;
    }

    virtual QString asJson() const {
        QJsonDocument doc(jObj);
        return doc.toJson(QJsonDocument::Compact);
    }

    virtual void fromJson(QString jsonString) {
        QJsonDocument doc = QJsonDocument::fromJson(jsonString.toUtf8());
        jObj = doc.object();
    }

    virtual void fromJsonObject(QJsonObject json) {
        jObj = json;
    }

    virtual bool isSet() const {
        return false;
    }

    virtual bool isValid() const {
        return true;
    }

private:
    QJsonObject jObj;
};

inline bool operator==(const PFXObject& left, const PFXObject& right){  
    return (left.asJsonObject() == right.asJsonObject());  
}

inline
#if QT_VERSION < 0x060000
uint
#else
size_t
#endif
qHash(const PFXObject& obj, uint seed = 0) noexcept{
    return qHash(obj.asJsonObject(), seed);
}

} // namespace test_namespace

Q_DECLARE_METATYPE(test_namespace::PFXObject)

#endif // PFX_OBJECT_H
