#ifndef __MESSAGE_H_
#define __MESSAGE_H_

#include <mecha.h>

enum e_MessageType
{
    MessageTypeRequest,
    MessageTypeResponse,
    MessageTypeErrorResponse
};

typedef enum e_MessageType MessageType;

typedef struct s_Message Message;

Message * message_new (const char *name, MessageType type);
void message_destroy (void *ptr);

Message * message_newRequest (const char *command);

void message_setParameter (Message *message, const char *key, const char *value);
const char * message_getParameter (Message *message, const char *key);

void message_setParameterBinary (Message *message, const char *key, const char *value, int valueLen);
void message_setParameterString (Message *message, const char *key, const dynTstring *value);
void message_setParameterInt (Message *message, const char *key, const int value);

const char * message_getCommand (Message *message);
MessageType message_getType (Message *message);

void message_setSequence (Message *message, int sequence);
int message_getSequence (Message *message);

Message * message_makeResponse (Message *request);
Message * message_makeErrorResponse (Message *request);

void message_print (Message *message);

dynTstring * message_getParameterString (Message *message, const char *key);


#endif
