// 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 "{{ snake_name }}.h"
{% for foreign_repository_header in foreign_repository_header_list %}
#include {{ foreign_repository_header }}
{% endfor %}
#include <qleany/contracts/database/interface_database_table_group.h>
#include <qleany/repository/generic_repository.h>
#include "repository/interface_{{ snake_name }}_repository.h"
#include "{{ export_header_file }}"
#include <QReadWriteLock>

using namespace Qleany;
using namespace Qleany::Contracts::Repository;
using namespace {{ application_cpp_domain_name }}::Contracts::Repository;
using namespace Qleany::Contracts::Database;

namespace {{ application_cpp_domain_name }}::Persistence::Repository
{

class {{ export }} {{ name }}Repository  final : public Qleany::Repository::GenericRepository<{{ application_cpp_domain_name }}::Domain::{{ name }}>,
                                          public {{ application_cpp_domain_name }}::Contracts::Repository::Interface{{ name }}Repository
{
  public:
    explicit {{ name }}Repository(InterfaceDatabaseTableGroup<{{ application_cpp_domain_name }}::Domain::{{ name }}> *{{ camel_name }}Database{{ foreign_repository_constructor_arguments_string }});

    SignalHolder *signalHolder() override;
    {% if loader_function_list %}
    Result<{{ application_cpp_domain_name }}::Domain::{{ name }}> update({{ application_cpp_domain_name }}::Domain::{{ name }} &&entity) override;
    Result<{{ application_cpp_domain_name }}::Domain::{{ name }}> getWithDetails(int entityId) override;
    {% endif %}
    {% for loader_function in loader_function_list %}
    {{ loader_function }}
    {% endfor %}
    Result<QHash<int, QList<int>>> removeInCascade(QList<int> ids) override;
    Result<QHash<int, QList<int>>> changeActiveStatusInCascade(QList<int> ids, bool active) override;


  private:
    {% for loader_private_member in loader_private_member_list %}
    {{ loader_private_member }}
    {% endfor %}
    QScopedPointer<SignalHolder> m_signalHolder;
    QReadWriteLock m_lock;

};

} // namespace {{ application_cpp_domain_name }}::Repository
