{{>licenseInfo}}
{{#models}}{{#model}}/*
 * {{classname}}.h
 *
 * {{description}}
 */

#ifndef {{classname}}_H
#define {{classname}}_H

#include "{{packageNameLowerCase}}exports.h"
{{#isEnum}}
#include "{{prefixLowerCase}}enum.h"
{{/isEnum}}
{{^isEnum}}
#include "{{prefixLowerCase}}object.h"
{{/isEnum}}
{{#enableQmlCode}}
#include <QtQmlIntegration/qqmlintegration.h>
{{/enableQmlCode}}

{{/model}}{{/models}}{{#imports}}{{{import}}}
{{/imports}}

{{#models}}
{{#model}}
{{#cppNamespaceDeclarations}}
namespace {{this}} {
{{/cppNamespaceDeclarations}}
{{#vendorExtensions.x-has-forward-declarations}}
{{#vendorExtensions.x-forward-declarations}}{{.}}
{{/vendorExtensions.x-forward-declarations}}{{/vendorExtensions.x-has-forward-declarations}}
class {{packageNameUpperCase}}_EXPORT {{classname}} : public {{cppCommonNamespace}}::{{prefix}}{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Enum{{/isEnum}} {
    Q_GADGET{{#enableQmlCode}}
    QML_VALUE_TYPE(data{{classname}}){{/enableQmlCode}}

{{^isEnum}}
{{#vars}}
    Q_PROPERTY({{{dataType}}} {{getter}}Value READ {{getter}}Value WRITE {{setter}})
{{/vars}}
{{/isEnum}}
public:
    {{classname}}();
    {{classname}}(const QString &json);
    ~{{classname}}() override;

    QString asJson() const override;
    QJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}} asJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}}() const override;
    void fromJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}}(const QJson{{^isEnum}}Object{{/isEnum}}{{#isEnum}}Value{{/isEnum}} &json) override;
    void fromJson(const QString &jsonString) override;
{{^isEnum}}{{#vars}}
    {{#deprecated}}Q_DECL_DEPRECATED {{/deprecated}}{{{dataType}}} {{getter}}Value() const;
    {{#deprecated}}Q_DECL_DEPRECATED {{/deprecated}}void {{setter}}(const {{{dataType}}} &{{name}});
    {{#deprecated}}Q_DECL_DEPRECATED {{/deprecated}}bool is{{#camelcase}}{{name}}{{/camelcase}}Set() const;
    {{#deprecated}}Q_DECL_DEPRECATED {{/deprecated}}bool is{{#camelcase}}{{name}}{{/camelcase}}Valid() const;
{{/vars}}{{/isEnum}}{{#isEnum}}
{{#allowableValues}}
    enum class e{{classname}} {{#enumVars}}{{#-first}}{{^isString}}: int {{/isString}}{{/-first}}{{/enumVars}}{
        INVALID_VALUE_OPENAPI_GENERATED = 0,
    {{#enumVars}}
        {{#enumDescription}}
        /**
        * {{.}}
        */
        {{/enumDescription}}
        {{{name}}}{{^-last}},{{/-last}}
    {{/enumVars}}
    };{{/allowableValues}}
    {{classname}}::e{{classname}} getValue() const;
    void setValue({{classname}}::e{{classname}} value);{{/isEnum}}
    bool isSet() const override;
    bool isValid() const override;

private:
    void initializeModel();
{{^isEnum}}{{#vars}}
    {{{dataType}}} m_{{name}};
    bool m_{{name}}IsSet;
    bool m_{{name}}IsValid;
{{/vars}}{{/isEnum}}{{#isEnum}}
    e{{classname}} m_value;
    bool m_valueIsSet;
    bool m_valueIsValid;
{{/isEnum}}};

{{#cppNamespaceDeclarations}}
} // namespace {{this}}
{{/cppNamespaceDeclarations}}

Q_DECLARE_METATYPE({{#cppNamespaceDeclarations}}{{this}}::{{/cppNamespaceDeclarations}}{{classname}})

#endif // {{classname}}_H
{{/model}}
{{/models}}
