#ifndef SLAVEAGENTHANDLEROFAGENT_HEADERFILE
#define SLAVEAGENTHANDLEROFAGENT_HEADERFILE

#include "SlaveAgentSlotOfAgent.h"
#include "Unit.h"
#include <vector>

using namespace std;

class SlaveAgentHandlerOfAgent : public Unit {

private:
  // TODO: set- and get function for maxNumOf_mountedSlaveAgents;
  vector<SlaveAgentSlotOfAgent *> vMountedSlaveAgents;
  unsigned int maxNumOfMountedSlaveAgents;

  void initSlaveAgentHandler();

public:
  SlaveAgentHandlerOfAgent();

  bool mount_slaveAgentIntoSlaveAgentSlot(Channel *inputPort);
  SlaveAgentSlotOfAgent *get_slaveAgentSlotAddress(Channel *inputPort);
  unsigned int get_slaveAgentSlotNumber(Channel *inputPort);
  SlaveAgentSlotOfAgent *get_slaveAgentSlotAddress(HistoryModule *history);
  SlaveAgentSlotOfAgent *
  get_slaveAgentSlotAddress(ConfidenceModule *confidenceModule);
  bool demount_slaveAgentIntoSlaveAgentSlot(Channel *inputPort);

  bool read_slaveAgentValue(SlaveAgentSlotOfAgent *slaveAgentSlot);
  bool read_allSlaveAgentValues();

  bool attach_historyModule(Channel *inputPort, HistoryModule *historyModule);
  bool detach_historyModule(SlaveAgentSlotOfAgent *slaveAgentSlotOfAgent);
  bool detach_historyModule(Channel *inputPort);
  bool detach_historyModule(HistoryModule *historyModule);
  HistoryModule *get_historyModuleOfSlaveAgentSlot(Channel *inputPort);

  bool attach_confidenceModule(Channel *inputPort,
                               ConfidenceModule *confidenceModule);
  bool detach_confidenceModule(SlaveAgentSlotOfAgent *slaveAgentSlotOfAgent);
  bool detach_confidenceModule(Channel *inputPort);
  bool detach_confidenceModule(ConfidenceModule *confidenceModule);
  ConfidenceModule *get_confidenceModuleOfSlaveAgentSlot(Channel *inputPort);

  vector<SlaveAgentSlotOfAgent *> *get_vMountedSlaveAgents();
};

#endif
