{%- set service = model.interfaces[0] -%}
{%- set dbus = service.dbus -%}
{%- set ident = dbus.name | replace(".", "_") -%}
// GENERATED FILE - DO NOT EDIT.
// Produced by clang-rpc-gen's GDBus backend from an annotated C++ header.
#pragma once

#include <string>
#include <string_view>
{% if service.signals %}
#include <vector>

#include <boost/signals2/connection.hpp>
{% endif %}

#include "rpc/dbus/GioInterface.hh"
#include "rpc/dbus/GioServer.hh"

#include "{{ header_include }}"

{% if adapter_namespace %}
namespace {{ adapter_namespace }}
{
{% endif %}
class {{ ident }} final : public ::workrave::rpc::dbus::GioInterface
{
public:
  {{ ident }}(::workrave::rpc::dbus::GioServer &server,
              std::string path,
              {{ service.cxx_qualified_class }} &implementation);
  ~{{ ident }}() override = default;

  [[nodiscard]] std::string_view name() const noexcept override;
  [[nodiscard]] std::string_view introspection() const noexcept override;
  void dispatch(std::string_view method,
                GVariant *parameters,
                GDBusMethodInvocation *invocation) override;

private:
{% for method in service.methods %}
  void dispatch_{{ method.rpc_name }}(GVariant *parameters, GDBusMethodInvocation *invocation);
{% endfor %}
{% for signal in service.signals %}
  void emit_{{ signal.rpc_name }}({% for field in signal.event_fields %}{% if not loop.first %}, {% endif %}{{ model.types[field.type_id].cxx.spelling }} {{ field.cxx_name }}{% endfor %});
{% endfor %}

{% if service.signals %}
  ::workrave::rpc::dbus::GioServer &server_;
{% endif %}
  std::string path_;
  {{ service.cxx_qualified_class }} &implementation_;
{% if service.signals %}
  std::vector<boost::signals2::scoped_connection> signal_connections_;
{% endif %}
};
{% if adapter_namespace %}
} // namespace {{ adapter_namespace }}
{% endif %}{{- "" -}}
