#ifndef COMPLIB_SERVER_MESSAGECREATION_HPP
#define COMPLIB_SERVER_MESSAGECREATION_HPP

#include <CompLib.pb.h>

namespace MessageBuilder {
  CompLib::Header *header(const std::string &message_type) {
    auto header = new CompLib::Header();
    header->set_message_type(message_type);
    return header;
  }

  CompLib::Status *status(bool successful, const std::string &error_message) {
    auto status = new CompLib::Status();
    status->set_successful(successful);
    status->set_error_message(error_message);
    return status;
  }

  CompLib::GenericResponse *genericResponse(bool successful, const std::string &error_message) {
    auto genericResponse = new CompLib::GenericResponse();
    genericResponse->set_allocated_header(header(CompLib::GenericResponse::descriptor()->full_name()));
    genericResponse->set_allocated_status(status(successful, error_message));
    return genericResponse;
  }
}

#endif //COMPLIB_SERVER_MESSAGECREATION_HPP
