#ifndef BIBUNM_PAYLOAD_REQUEST_H
#define BIBUNM_PAYLOAD_REQUEST_H

#include "bibun_messenging/request.h"
#include "bibun_messenging/payload.h"

namespace bibunm
{

namespace internal_objects
{

class PayloadRequest : public Request
{
   friend Receiver;
public:
   /// @name Move and Copy
   /// Move and copy semantics for PayloadRequest are defaulted. All members are copyable and movable.
   /// @{
   PayloadRequest(const PayloadRequest &) = default;
   PayloadRequest &operator=(const PayloadRequest &) = default;
   PayloadRequest(PayloadRequest &&other) noexcept = default;
   PayloadRequest &operator=(PayloadRequest &&other) noexcept = default;
   /// @}

   Payload &payload();
   const Payload &payload() const;

   virtual ~PayloadRequest();
protected:
   // Constructor for derived classes. We don't want users creating PayloadRequests.
   PayloadRequest(bibunm::Payload payload);

   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:
   virtual const char *wireName() const = 0;

   bibunm::Payload _payload;
   static const char *_payload_sz_hdr_key;
   static const char *_payload_type_hdr_key;
};

}
}

#endif // BIBUNM_PAYLOAD_REQUEST_H
