// This file was generated automatically by Qleany's generator, edit at your own risk! 
// If you do, be careful to not overwrite it when you run the generator again.
#pragma once

#include "{{ export_header_file }}"
#include <QObject>
{% for field in single.fields %}
{% if field.type == "QDate" %}
#include <QDate>
{%- else %}{% endif %}
{%- endfor %}
{% for field in single.fields %}
{% if field.type == "QTime" %}
#include <QTime>
{%- else %}{% endif %}
{%- endfor %}
{% for field in single.fields %}
{% if field.type == "QDateTime" %}
#include <QDateTime>
{%- else %}{% endif %}
{%- endfor %}
{% for field in single.fields %}
{% if field.type == "QUrl" %}
#include <QUrl>
{%- else %}{% endif %}
{%- endfor %}
{% for field in single.fields %}
{% if field.type == "QByteArray" %}
#include <QByteArray>
{%- else %}{% endif %}
{%- endfor %}
{% for field in single.fields %}
{% if field.type == "QUuid" %}
#include <QUuid>
{%- else %}{% endif %}
{%- endfor %}



namespace {{ application_cpp_domain_name }}::Presenter
{
class {{ export }} {{ single.class_name_pascal }} : public QObject
{
    Q_OBJECT
    Q_PROPERTY(int itemId READ id WRITE setId RESET resetId NOTIFY idChanged FINAL)
    {% for field in single.fields %}
    {%- if field.camel_name != "id" %}
    Q_PROPERTY({{ field.type }} {{ field.camel_name }} READ {{ field.camel_name }} {% if not single.read_only %}WRITE set{{ field.pascal_name }}{% endif %} NOTIFY {{ field.camel_name }}Changed FINAL)
    {%- endif %}
    {%- endfor %}

  public:
    explicit {{ single.class_name_pascal }}(QObject *parent = nullptr);

    int id() const;
    void setId(int newId);
    void resetId();

    {% for field in single.fields %}
    {% if field.camel_name != "id" -%}
    {{ field.type }} {{ field.camel_name }}() const;
    {% if not single.read_only -%}
    void set{{ field.pascal_name }}({% if field.type in ['int', 'double', 'float', 'bool'] %}{{ field.type }} new{{ field.pascal_name }}{% else %} const {{ field.type }} &new{{ field.pascal_name }}{% endif %});
    {% endif -%}
    {% endif -%}
    {%- endfor %}

  Q_SIGNALS:

    void idChanged();
    {% for field in single.fields %}
    {%- if field.camel_name != "id" %}
    void {{ field.camel_name }}Changed();
    {%- endif %}
    {%- endfor %}

  private:
    int m_id;
    
    {% for field in single.fields %}
    {%- if field.camel_name != "id" %}
    {{ field.type }} m_{{ field.camel_name }};
    {%- endif %}
    {%- endfor %}
};

} // namespace {{ application_cpp_domain_name }}::Presenter
