/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2020, Regents of the University of California
 *
 * BSD license, See the LICENSE file for more information
 *
 * Author: Qiuhan Ding <qiuhanding@cs.ucla.edu>
 */

#ifndef CHRONOCHAT_CONF_HPP
#define CHRONOCHAT_CONF_HPP

#include "common.hpp"
#include "tlv.hpp"

namespace chronochat {

class Conf
{

public:

  class Error : public std::runtime_error
  {
  public:
    explicit
    Error(const std::string& what)
      : std::runtime_error(what)
    {
    }
  };

public:

  Conf();

  explicit
  Conf(const Block& confWire);

  const Block&
  wireEncode() const;

  void
  wireDecode(const Block& confWire);

  const Name&
  getIdentity() const;

  const std::string&
  getNick() const;

  void
  setIdentity(const Name& identity);

  void
  setNick(const std::string& nick);

private:
  template<ndn::encoding::Tag T>
  size_t
  wireEncode(ndn::EncodingImpl<T>& block) const;

private:
  mutable Block m_wire;
  Name m_identity;
  std::string m_nick;
};

inline const Name&
Conf::getIdentity() const
{
  return m_identity;
}

inline const std::string&
Conf::getNick() const
{
  return m_nick;
}

} // namespace chronochat

#endif // CHRONOCHAT_CONF_HPP
