176833cb5SWludzik, Jozef #pragma once
276833cb5SWludzik, Jozef 
351f0fd50SKrzysztof Grobelny #include "types/duration_types.hpp"
4dcc4e193SKrzysztof Grobelny #include "types/trigger_types.hpp"
576833cb5SWludzik, Jozef 
6e8fc5751SKrzysztof Grobelny #include <sdbusplus/message.hpp>
7e8fc5751SKrzysztof Grobelny 
81477fe6aSWludzik, Jozef #include <chrono>
976833cb5SWludzik, Jozef #include <utility>
1076833cb5SWludzik, Jozef 
1176833cb5SWludzik, Jozef class TriggerParams
1276833cb5SWludzik, Jozef {
1376833cb5SWludzik, Jozef   public:
14e28aa53dSSzymon Dompke     TriggerParams& id(std::string val)
15e28aa53dSSzymon Dompke     {
16e28aa53dSSzymon Dompke         idProperty = std::move(val);
17e28aa53dSSzymon Dompke         return *this;
18e28aa53dSSzymon Dompke     }
19e28aa53dSSzymon Dompke 
20e28aa53dSSzymon Dompke     const std::string& id() const
21e28aa53dSSzymon Dompke     {
22e28aa53dSSzymon Dompke         return idProperty;
23e28aa53dSSzymon Dompke     }
24e28aa53dSSzymon Dompke 
2576833cb5SWludzik, Jozef     TriggerParams& name(std::string val)
2676833cb5SWludzik, Jozef     {
2776833cb5SWludzik, Jozef         nameProperty = std::move(val);
2876833cb5SWludzik, Jozef         return *this;
2976833cb5SWludzik, Jozef     }
3076833cb5SWludzik, Jozef 
3176833cb5SWludzik, Jozef     const std::string& name() const
3276833cb5SWludzik, Jozef     {
3376833cb5SWludzik, Jozef         return nameProperty;
3476833cb5SWludzik, Jozef     }
3576833cb5SWludzik, Jozef 
36*94f71c51SSzymon Dompke     TriggerParams& triggerActions(const std::vector<TriggerAction>& val)
37f763c9e3SSzymon Dompke     {
382001301aSSzymon Dompke         triggerActionsProperty = val;
39f763c9e3SSzymon Dompke         return *this;
40f763c9e3SSzymon Dompke     }
41f763c9e3SSzymon Dompke 
42*94f71c51SSzymon Dompke     const std::vector<TriggerAction>& triggerActions() const
4376833cb5SWludzik, Jozef     {
442001301aSSzymon Dompke         return triggerActionsProperty;
4576833cb5SWludzik, Jozef     }
4676833cb5SWludzik, Jozef 
474416fce6SCezary Zwolak     const std::vector<LabeledSensorInfo>& sensors() const
4876833cb5SWludzik, Jozef     {
494416fce6SCezary Zwolak         return labeledSensorsProperty;
5076833cb5SWludzik, Jozef     }
5176833cb5SWludzik, Jozef 
52b8cc78ddSKrzysztof Grobelny     const std::vector<std::string>& reportIds() const
5376833cb5SWludzik, Jozef     {
54b8cc78ddSKrzysztof Grobelny         return reportIdsProperty;
5576833cb5SWludzik, Jozef     }
5676833cb5SWludzik, Jozef 
574416fce6SCezary Zwolak     TriggerParams& thresholdParams(LabeledTriggerThresholdParams val)
58f763c9e3SSzymon Dompke     {
594416fce6SCezary Zwolak         labeledThresholdsProperty = std::move(val);
60f763c9e3SSzymon Dompke         return *this;
61f763c9e3SSzymon Dompke     }
62f763c9e3SSzymon Dompke 
634416fce6SCezary Zwolak     const LabeledTriggerThresholdParams& thresholdParams() const
6476833cb5SWludzik, Jozef     {
654416fce6SCezary Zwolak         return labeledThresholdsProperty;
6676833cb5SWludzik, Jozef     }
6776833cb5SWludzik, Jozef 
6876833cb5SWludzik, Jozef   private:
69e28aa53dSSzymon Dompke     std::string idProperty = "Trigger1";
70e28aa53dSSzymon Dompke     std::string nameProperty = "My Numeric Trigger";
71*94f71c51SSzymon Dompke     std::vector<TriggerAction> triggerActionsProperty = {
72*94f71c51SSzymon Dompke         TriggerAction::UpdateReport};
734416fce6SCezary Zwolak     std::vector<LabeledSensorInfo> labeledSensorsProperty = {
744416fce6SCezary Zwolak         {"service1", "/xyz/openbmc_project/sensors/temperature/BMC_Temp",
754416fce6SCezary Zwolak          "metadata1"}};
76b8cc78ddSKrzysztof Grobelny     std::vector<std::string> reportIdsProperty = {"Report1"};
774416fce6SCezary Zwolak     LabeledTriggerThresholdParams labeledThresholdsProperty =
784416fce6SCezary Zwolak         std::vector<numeric::LabeledThresholdParam>{
79dcc4e193SKrzysztof Grobelny             numeric::LabeledThresholdParam{numeric::Type::lowerCritical,
80dcc4e193SKrzysztof Grobelny                                            Milliseconds(10).count(),
814416fce6SCezary Zwolak                                            numeric::Direction::decreasing, 0.5},
824416fce6SCezary Zwolak             numeric::LabeledThresholdParam{
83dcc4e193SKrzysztof Grobelny                 numeric::Type::upperCritical, Milliseconds(10).count(),
844416fce6SCezary Zwolak                 numeric::Direction::increasing, 90.2}};
8576833cb5SWludzik, Jozef };
86