/* Blinker
   Copyright 2011-2019 Stefan Schuermans <stefan@blinkenarea.org>
   Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
   a blinkenarea.org project */

#ifndef BLINKER_PHONEEXTENSION_H
#define BLINKER_PHONEEXTENSION_H

#include <string>

#include "Directory.h"
#include "Module.h"
#include "NameFile.h"
#include "Phone.h"

namespace Blinker {

/// phone extension to call
template<typename ADDR, typename SOCK>
class Phone<ADDR, SOCK>::Extension
{
public:
  /**
   * @brief constructor
   * @param[in] phone owning phone object
   * @param[in] name extension name (i.e. phone number)
   * @param[in] dirBase base directory
   */
  Extension(Phone &phone, const std::string &name, const Directory &dirBase);

  /// destructor
  ~Extension();

private:
  /// copy constructor disabled
  Extension(const Extension &that);

  /// assignment operator disabled
  const Extension & operator=(const Extension &that);

public:
  /// check for update of configuration
  void updateConfig();

protected:
  /// (re-)get target operator interface to connect to
  void getTarget();

protected:
  Phone       &m_phone;     ///< owning phone object
  std::string m_name;       ///< extension name (i.e. phone number)
  NameFile    m_fileTarget; ///< target operator interface name to connect to
}; // class Phone<ADDR, SOCK>::Extension

} // namespace Blinker

#endif // #ifndef BLINKER_PHONEEXTENSION_H

