Using enum class instead of string in more places

ReportingType and ReportUpdates are now used as enum class in more
places than before. Changed how this two fields are stored in
persistent configuration. Increased Report::Version to break backward
compatibility. Updated unit tests to verify changed functionality.

Tested:
- All existing tests are passing

Change-Id: I55db205aefbe2b5a69fb7a31ccf11885aaecaaf2
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/src/types/report_updates.hpp b/src/types/report_updates.hpp
new file mode 100644
index 0000000..a47e8fb
--- /dev/null
+++ b/src/types/report_updates.hpp
@@ -0,0 +1,62 @@
+#pragma once
+
+#include "utils/conversion.hpp"
+
+#include <sdbusplus/exception.hpp>
+
+#include <array>
+#include <cstdint>
+#include <string_view>
+#include <type_traits>
+
+enum class ReportUpdates : uint32_t
+{
+    overwrite,
+    appendStopsWhenFull,
+    appendWrapsWhenFull,
+    newReport
+};
+
+namespace utils
+{
+
+template <>
+struct EnumTraits<ReportUpdates>
+{
+    [[noreturn]] static void throwConversionError()
+    {
+        throw sdbusplus::exception::SdBusError(
+            static_cast<int>(std::errc::invalid_argument),
+            "Invalid ReportUpdates");
+    }
+};
+
+constexpr std::array<std::pair<std::string_view, ReportUpdates>, 4>
+    convDataReportUpdates = {
+        {std::make_pair<std::string_view, ReportUpdates>(
+             "Overwrite", ReportUpdates::overwrite),
+         std::make_pair<std::string_view, ReportUpdates>(
+             "AppendStopsWhenFull", ReportUpdates::appendStopsWhenFull),
+         std::make_pair<std::string_view, ReportUpdates>(
+             "AppendWrapsWhenFull", ReportUpdates::appendWrapsWhenFull),
+         std::make_pair<std::string_view, ReportUpdates>(
+             "NewReport", ReportUpdates::newReport)}};
+
+inline ReportUpdates
+    toReportUpdates(std::underlying_type_t<ReportUpdates> value)
+{
+    return toEnum<ReportUpdates, minEnumValue(convDataReportUpdates),
+                  maxEnumValue(convDataReportUpdates)>(value);
+}
+
+inline ReportUpdates toReportUpdates(const std::string& value)
+{
+    return toEnum(convDataReportUpdates, value);
+}
+
+inline std::string enumToString(ReportUpdates value)
+{
+    return std::string(enumToString(convDataReportUpdates, value));
+}
+
+} // namespace utils