#pragma once #include "interfaces/json_storage.hpp" #include "types/trigger_types.hpp" namespace utils { class ToLabeledThresholdParamConversion { public: LabeledTriggerThresholdParams operator()(const std::monostate& arg) const; LabeledTriggerThresholdParams operator()(const std::vector& arg) const; LabeledTriggerThresholdParams operator()(const std::vector& arg) const; }; class FromLabeledThresholdParamConversion { public: TriggerThresholdParams operator()( const std::vector& arg) const; TriggerThresholdParams operator()( const std::vector& arg) const; }; SensorsInfo fromLabeledSensorsInfo(const std::vector& infos); TriggerThresholdParams fromLabeledThresholdParam(const std::vector& params); nlohmann::json labeledThresholdParamsToJson( const LabeledTriggerThresholdParams& labeledThresholdParams); template struct is_variant : std::false_type {}; template struct is_variant> : std::true_type {}; template inline constexpr bool is_variant_v = is_variant::value; template requires is_variant_v bool isFirstElementOfType(const std::vector& collection) { if (collection.empty()) { return false; } return std::holds_alternative(*collection.begin()); } double stodStrict(const std::string& str); } // namespace utils