Implement Report persistency

Now Report properties are stored in non-volatile memory. It allows
to restore Report after system restart. Persistency of a report is
controlled by Persistency property in Report interface.

Tested:
 - Passed unit tests
 - Verified that report is stored in /var/lib/telemetry dir
 - Verified that report is restored from storage after telemetry
   service start

Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Change-Id: Iccfe21603eecffc4e174a4403f699b03de320db9
diff --git a/src/interfaces/json_storage.hpp b/src/interfaces/json_storage.hpp
index badd938..491d4d9 100644
--- a/src/interfaces/json_storage.hpp
+++ b/src/interfaces/json_storage.hpp
@@ -20,10 +20,10 @@
 
     virtual void store(const FilePath& subPath, const nlohmann::json& data) = 0;
     virtual bool remove(const FilePath& subPath) = 0;
+    virtual bool exist(const FilePath& path) const = 0;
     virtual std::optional<nlohmann::json>
         load(const FilePath& subPath) const = 0;
-    virtual std::vector<FilePath>
-        list(const DirectoryPath& subDirectory) const = 0;
+    virtual std::vector<FilePath> list() const = 0;
 };
 
 } // namespace interfaces
diff --git a/src/interfaces/metric.hpp b/src/interfaces/metric.hpp
index 51fc8fa..50bf5d5 100644
--- a/src/interfaces/metric.hpp
+++ b/src/interfaces/metric.hpp
@@ -2,6 +2,8 @@
 
 #include "metric_value.hpp"
 
+#include <nlohmann/json.hpp>
+
 #include <vector>
 
 namespace interfaces
@@ -13,6 +15,7 @@
     virtual ~Metric() = default;
 
     virtual const std::vector<MetricValue>& getReadings() const = 0;
+    virtual nlohmann::json to_json() const = 0;
 };
 
 } // namespace interfaces
diff --git a/src/interfaces/report_factory.hpp b/src/interfaces/report_factory.hpp
index 9273d03..056c9e0 100644
--- a/src/interfaces/report_factory.hpp
+++ b/src/interfaces/report_factory.hpp
@@ -1,13 +1,15 @@
 #pragma once
 
+#include "interfaces/json_storage.hpp"
 #include "interfaces/report.hpp"
 #include "interfaces/report_manager.hpp"
 #include "interfaces/types.hpp"
 
+#include <boost/asio/spawn.hpp>
+
 #include <chrono>
 #include <memory>
-
-class ReportManager;
+#include <optional>
 
 namespace interfaces
 {
@@ -17,12 +19,12 @@
   public:
     virtual ~ReportFactory() = default;
 
-    virtual std::unique_ptr<interfaces::Report>
-        make(const std::string& name, const std::string& reportingType,
-             bool emitsReadingsSignal, bool logToMetricReportsCollection,
-             std::chrono::milliseconds period,
-             const ReadingParameters& metricParams,
-             ReportManager& reportManager) const = 0;
+    virtual std::unique_ptr<interfaces::Report> make(
+        std::optional<std::reference_wrapper<boost::asio::yield_context>> yield,
+        const std::string& name, const std::string& reportingType,
+        bool emitsReadingsSignal, bool logToMetricReportsCollection,
+        std::chrono::milliseconds period, const ReadingParameters& metricParams,
+        ReportManager& reportManager, JsonStorage& reportStorage) const = 0;
 };
 
 } // namespace interfaces
diff --git a/src/interfaces/types.hpp b/src/interfaces/types.hpp
index 0d5eeb2..1eca51a 100644
--- a/src/interfaces/types.hpp
+++ b/src/interfaces/types.hpp
@@ -1,5 +1,8 @@
 #pragma once
 
+#include "utils/labeled_tuple.hpp"
+#include "utils/tstring.hpp"
+
 #include <sdbusplus/message/types.hpp>
 
 #include <string>
@@ -10,6 +13,12 @@
     std::vector<std::tuple<std::vector<sdbusplus::message::object_path>,
                            std::string, std::string, std::string>>;
 
+using LabeledReadingParameter =
+    utils::LabeledTuple<ReadingParameters::value_type,
+                        utils::tstring::SensorPaths,
+                        utils::tstring::OperationType, utils::tstring::Id,
+                        utils::tstring::MetricMetadata>;
+
 using Readings = std::tuple<
     uint64_t,
     std::vector<std::tuple<std::string, std::string, double, uint64_t>>>;