1 #pragma once
2 
3 #include "report_manager.hpp"
4 #include "types/report_types.hpp"
5 
6 #include <chrono>
7 #include <string>
8 
9 class ReportParams final
10 {
11   public:
reportId(std::string_view val)12     ReportParams& reportId(std::string_view val)
13     {
14         reportIdProperty = val;
15         return *this;
16     }
17 
reportId() const18     const std::string& reportId() const
19     {
20         return reportIdProperty;
21     }
22 
reportName(std::string_view val)23     ReportParams& reportName(std::string_view val)
24     {
25         reportNameProperty = val;
26         return *this;
27     }
28 
reportName() const29     const std::string& reportName() const
30     {
31         return reportNameProperty;
32     }
33 
reportingType(const ReportingType val)34     ReportParams& reportingType(const ReportingType val)
35     {
36         reportingTypeProperty = val;
37         return *this;
38     }
39 
reportingType() const40     ReportingType reportingType() const
41     {
42         return reportingTypeProperty;
43     }
44 
reportActions(std::vector<ReportAction> val)45     ReportParams& reportActions(std::vector<ReportAction> val)
46     {
47         reportActionsProperty = std::move(val);
48         return *this;
49     }
50 
reportActions() const51     std::vector<ReportAction> reportActions() const
52     {
53         return reportActionsProperty;
54     }
55 
interval(Milliseconds val)56     ReportParams& interval(Milliseconds val)
57     {
58         intervalProperty = val;
59         return *this;
60     }
61 
interval() const62     Milliseconds interval() const
63     {
64         return intervalProperty;
65     }
66 
enabled(bool val)67     ReportParams& enabled(bool val)
68     {
69         enabledProperty = val;
70         return *this;
71     }
72 
enabled() const73     bool enabled() const
74     {
75         return enabledProperty;
76     }
77 
appendLimit(uint64_t val)78     ReportParams& appendLimit(uint64_t val)
79     {
80         appendLimitProperty = val;
81         return *this;
82     }
83 
appendLimit() const84     uint64_t appendLimit() const
85     {
86         return appendLimitProperty;
87     }
88 
reportUpdates(ReportUpdates val)89     ReportParams& reportUpdates(ReportUpdates val)
90     {
91         reportUpdatesProperty = val;
92         return *this;
93     }
94 
reportUpdates() const95     ReportUpdates reportUpdates() const
96     {
97         return reportUpdatesProperty;
98     }
99 
metricParameters(std::vector<LabeledMetricParameters> val)100     ReportParams& metricParameters(std::vector<LabeledMetricParameters> val)
101     {
102         metricParametersProperty = std::move(val);
103         return *this;
104     }
105 
metricParameters() const106     const std::vector<LabeledMetricParameters>& metricParameters() const
107     {
108         return metricParametersProperty;
109     }
110 
readings(Readings val)111     ReportParams& readings(Readings val)
112     {
113         readingsProperty = std::move(val);
114         return *this;
115     }
116 
readings() const117     Readings readings() const
118     {
119         return readingsProperty;
120     }
121 
122   private:
123     std::string reportIdProperty = "TestId";
124     std::string reportNameProperty = "TestReport";
125     ReportingType reportingTypeProperty = ReportingType::onChange;
126     std::vector<ReportAction> reportActionsProperty = {
127         ReportAction::logToMetricReportsCollection};
128     Milliseconds intervalProperty{};
129     uint64_t appendLimitProperty = 123;
130     ReportUpdates reportUpdatesProperty = ReportUpdates::overwrite;
131     std::vector<LabeledMetricParameters> metricParametersProperty{
132         {LabeledMetricParameters{
133              {LabeledSensorInfo{"Service",
134                                 "/xyz/openbmc_project/sensors/power/p1",
135                                 "metadata1"}},
136              OperationType::avg,
137              CollectionTimeScope::point,
138              CollectionDuration(Milliseconds(0u))},
139          LabeledMetricParameters{
140              {LabeledSensorInfo{"Service",
141                                 "/xyz/openbmc_project/sensors/power/p2",
142                                 "metadata2"}},
143              OperationType::avg,
144              CollectionTimeScope::point,
145              CollectionDuration(Milliseconds(0u))}}};
146     bool enabledProperty = true;
147     Readings readingsProperty = {};
148 };
149