#ifndef BIBUNM_REGISTRY_H
#define BIBUNM_REGISTRY_H

#include "bibun_messenging/payload_request.h"

namespace bibunm
{

class Receiver;

class Registry : public internal_objects::PayloadRequest
{
   friend class Receiver;
public:
   Registry(Payload payload);

   /// @name Move and Copy
   /// Move and copy semantics for Registry are defaulted. All members are copyable and movable.
   /// @{
   Registry(const Registry &) = default;
   Registry(Registry &&) noexcept = default;
   Registry &operator=(const Registry &) = default;
   Registry &operator=(Registry &&) noexcept = default;
   /// @}

   virtual ~Registry();
protected:
   virtual std::map<std::string, std::string> create_protocol_headers() const;

   virtual void handle_protocol_headers(std::map<std::string, std::string> &protocol_headers);
private:
   ///
   /// \brief Construct Registry from encoded request.
   /// \param payload The payload of the registry, usually some JSON blob of known nodes.
   /// \param routes Routes where this message came from.
   /// \param protocol_headers Encoded headers that should be destroyed by the end of this.
   ///
   Registry(Payload payload,
            std::map<std::string, std::string> &protocol_headers);

   virtual const char *wireName() const final;
   static const char *_wire_name;
};

}

#endif // BIBUNM_REGISTRY_H
