// 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 }}"
#include "{{ feature_snake_name }}/{{ entity_mappable_with_snake }}_dto.h"
#include "{{ feature_snake_name }}/commands/remove_{{ entity_mappable_with_snake }}_command.h"

#include "repository/interface_{{ entity_mappable_with_snake }}_repository.h"
#include <qleany/common/result.h>
#include <QPromise>

using namespace Qleany;
using namespace {{ application_cpp_domain_name }}::Contracts::DTO::{{ feature_pascal_name }};
using namespace {{ application_cpp_domain_name }}::Contracts::Repository;
using namespace {{ application_cpp_domain_name }}::Contracts::CQRS::{{ feature_pascal_name }}::Commands;

namespace {{ application_cpp_domain_name }}::Application::Features::{{ feature_pascal_name }}::Commands
{
class {{ export }} Remove{{ entity_mappable_with_pascal }}CommandHandler : public QObject 
{
    Q_OBJECT
  public:
    Remove{{ entity_mappable_with_pascal }}CommandHandler(Interface{{ entity_mappable_with_pascal }}Repository *repository);
    Result<int> handle(QPromise<Result<void>> &progressPromise, const Remove{{ entity_mappable_with_pascal }}Command &request);
    Result<int> restore();

  signals:
    // repositories handle remove signals
    //void {{ entity_mappable_with_camel }}Removed(int id);

  private:
    Interface{{ entity_mappable_with_pascal }}Repository *m_repository;
    Result<int> handleImpl(QPromise<Result<void> >   & progressPromise, const Remove{{ entity_mappable_with_pascal }}Command &request);
    Result<int> restoreImpl();
    {{ application_cpp_domain_name }}::Domain::{{ entity_mappable_with_pascal }} m_oldState;
    static bool s_mappingRegistered;
    void registerMappings();
};

} // namespace {{ application_cpp_domain_name }}::Application::Features::{{ feature_pascal_name }}::Commands
