#ifndef __SubscriptionManager_h__
#define __SubscriptionManager_h__

#include "Command.h"
#include "Subscription.h"
#include "TCPSession.h"
#include "ZString.h"
#include <string>
#include <vector>

namespace core
{

  class SubscriptionManager : public Command
  {

  public:
    SubscriptionManager();

    int add(Subscription &subscription);
    int addHandler(std::string name, SubscriptionHandler &handler);

    int removeSessionSubscriptions(TCPSession &session);

    int processCommand(coreutils::ZString &request, TCPSession &session) override;

  private:
    std::map<std::string, Subscription *> subscriptions;
    std::map<std::string, SubscriptionHandler> handlers;
    std::mutex lock;
  };
}

#endif
