1 #pragma once
2 
3 #include "types/milliseconds.hpp"
4 #include "types/trigger_types.hpp"
5 
6 #include <sdbusplus/message.hpp>
7 
8 #include <chrono>
9 #include <utility>
10 
11 class TriggerParams
12 {
13   public:
14     TriggerParams& id(std::string val)
15     {
16         idProperty = std::move(val);
17         return *this;
18     }
19 
20     const std::string& id() const
21     {
22         return idProperty;
23     }
24 
25     TriggerParams& name(std::string val)
26     {
27         nameProperty = std::move(val);
28         return *this;
29     }
30 
31     const std::string& name() const
32     {
33         return nameProperty;
34     }
35 
36     TriggerParams& triggerActions(const std::vector<std::string>& val)
37     {
38         triggerActionsProperty = val;
39         return *this;
40     }
41 
42     const std::vector<std::string>& triggerActions() const
43     {
44         return triggerActionsProperty;
45     }
46 
47     const std::vector<LabeledSensorInfo>& sensors() const
48     {
49         return labeledSensorsProperty;
50     }
51 
52     const std::vector<std::string>& reportNames() const
53     {
54         return reportNamesProperty;
55     }
56 
57     TriggerParams& thresholdParams(LabeledTriggerThresholdParams val)
58     {
59         labeledThresholdsProperty = std::move(val);
60         return *this;
61     }
62 
63     const LabeledTriggerThresholdParams& thresholdParams() const
64     {
65         return labeledThresholdsProperty;
66     }
67 
68   private:
69     std::string idProperty = "Trigger1";
70     std::string nameProperty = "My Numeric Trigger";
71     std::vector<std::string> triggerActionsProperty = {"UpdateReport"};
72 
73     std::vector<LabeledSensorInfo> labeledSensorsProperty = {
74         {"service1", "/xyz/openbmc_project/sensors/temperature/BMC_Temp",
75          "metadata1"}};
76     std::vector<std::string> reportNamesProperty = {"Report1"};
77     LabeledTriggerThresholdParams labeledThresholdsProperty =
78         std::vector<numeric::LabeledThresholdParam>{
79             numeric::LabeledThresholdParam{numeric::Type::lowerCritical,
80                                            Milliseconds(10).count(),
81                                            numeric::Direction::decreasing, 0.5},
82             numeric::LabeledThresholdParam{
83                 numeric::Type::upperCritical, Milliseconds(10).count(),
84                 numeric::Direction::increasing, 90.2}};
85 };
86