#pragma once

#include "ros_bridge/rapidjson/include/rapidjson/document.h"

#include <memory>
#include <deque>
#include <unordered_map>

namespace ros_bridge {
namespace com_private {

typedef rapidjson::Document JsonDoc;
typedef std::unique_ptr<JsonDoc> JsonDocUPtr;
typedef std::deque<JsonDocUPtr> JsonQueue;
typedef std::size_t HashType;

using ClientMap = std::unordered_map<HashType, std::string>;

static const char* _topicAdvertiserKey = "topic_advertiser";
static const char* _topicPublisherKey =  "topic_publisher";
static const char* _serviceAdvertiserKey = "service_advertiser";
static const char* _topicSubscriberKey = "topic_subscriber";

std::size_t getHash(const std::string &str);
std::size_t getHash(const char *str);

bool getTopic(const JsonDoc &doc, std::string &topic);
bool getType(const JsonDoc &doc, std::string &type);

bool removeTopic(JsonDoc &doc);
bool removeType(JsonDoc &doc);

}
}
