/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2016-2022, Regents of the University of California,
 *                          Colorado State University,
 *                          University Pierre & Marie Curie, Sorbonne University.
 *
 * This file is part of ndn-tools (Named Data Networking Essential Tools).
 * See AUTHORS.md for complete list of ndn-tools authors and contributors.
 *
 * ndn-tools is free software: you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
 *
 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
 *
 * @author Wentao Shang
 * @author Steve DiBenedetto
 * @author Andrea Tosatto
 * @author Davide Pesavento
 * @author Klaus Schneider
 */

#ifndef NDN_TOOLS_CHUNKS_PUTCHUNKS_PRODUCER_HPP
#define NDN_TOOLS_CHUNKS_PUTCHUNKS_PRODUCER_HPP

#include "core/common.hpp"

namespace ndn::chunks {

/**
 * @brief Segmented & versioned data publisher.
 *
 * Packetizes and publishes data from an input stream as `/prefix/<version>/<segment number>`.
 * Unless another value is provided, the current time is used as the version number.
 * The packet store always has at least one item, even when the input is empty.
 */
class Producer : noncopyable
{
public:
  struct Options
  {
    security::SigningInfo signingInfo;
    time::milliseconds freshnessPeriod = 10_s;
    size_t maxSegmentSize = 8000;
    bool isQuiet = false;
    bool isVerbose = false;
    bool wantShowVersion = false;
  };

  /**
   * @brief Create the producer.
   * @param prefix prefix used to publish data; if the last component is not a valid
   *               version number, the current system time is used as version number.
   */
  Producer(const Name& prefix, Face& face, KeyChain& keyChain, std::istream& is,
           const Options& opts);

  /**
   * @brief Run the producer.
   */
  void
  run();

private:
  /**
   * @brief Respond with a metadata packet containing the versioned content name.
   */
  void
  processDiscoveryInterest(const Interest& interest);

  /**
   * @brief Respond with the requested segment of content.
   */
  void
  processSegmentInterest(const Interest& interest);

PUBLIC_WITH_TESTS_ELSE_PRIVATE:
  std::vector<shared_ptr<Data>> m_store;

private:
  Name m_prefix;
  Name m_versionedPrefix;
  Face& m_face;
  KeyChain& m_keyChain;
  const Options m_options;
};

} // namespace ndn::chunks

#endif // NDN_TOOLS_CHUNKS_PUTCHUNKS_PRODUCER_HPP
