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/report.hpp b/src/report.hpp
index 8cef26a..2020f99 100644
--- a/src/report.hpp
+++ b/src/report.hpp
@@ -1,5 +1,6 @@
 #pragma once
 
+#include "interfaces/json_storage.hpp"
 #include "interfaces/metric.hpp"
 #include "interfaces/report.hpp"
 #include "interfaces/report_manager.hpp"
@@ -23,6 +24,7 @@
            const std::chrono::milliseconds period,
            const ReadingParameters& metricParams,
            interfaces::ReportManager& reportManager,
+           interfaces::JsonStorage& reportStorage,
            std::vector<std::shared_ptr<interfaces::Metric>> metrics);
     ~Report() = default;
 
@@ -41,6 +43,8 @@
         return path;
     }
 
+    bool storeConfiguration() const;
+
   private:
     static void timerProc(boost::system::error_code, Report& self);
     void scheduleTimer(std::chrono::milliseconds interval);
@@ -48,7 +52,12 @@
 
     const std::string name;
     const std::string path;
+    std::string reportingType;
     std::chrono::milliseconds interval;
+    bool emitsReadingsUpdate;
+    bool logToMetricReportsCollection;
+    ReadingParameters readingParameters;
+    bool persistency;
     Readings readings = {};
     std::tuple_element_t<1, Readings> readingsCache = {};
     std::shared_ptr<sdbusplus::asio::object_server> objServer;
@@ -57,6 +66,9 @@
     std::vector<std::shared_ptr<interfaces::Metric>> metrics;
     boost::asio::steady_timer timer;
 
+    interfaces::JsonStorage::FilePath fileName;
+    interfaces::JsonStorage& reportStorage;
+
   public:
     static constexpr const char* reportIfaceName =
         "xyz.openbmc_project.Telemetry.Report";
@@ -64,4 +76,5 @@
         "/xyz/openbmc_project/Telemetry/Reports/";
     static constexpr const char* deleteIfaceName =
         "xyz.openbmc_project.Object.Delete";
+    static constexpr size_t reportVersion = 1;
 };