1 #pragma once
2 #include "registries/heartbeat_event_message_registry.hpp"
3 
4 #include <nlohmann/json.hpp>
5 
6 #include <array>
7 #include <span>
8 #include <string_view>
9 
10 namespace redfish::messages
11 {
12 
13 inline nlohmann::json
14     getLogHeartbeat(redfish::registries::heartbeat_event::Index name,
15                     std::span<const std::string_view> args)
16 {
17     size_t index = static_cast<size_t>(name);
18     if (index >= redfish::registries::heartbeat_event::registry.size())
19     {
20         return {};
21     }
22     return getLogFromRegistry(redfish::registries::heartbeat_event::header,
23                               redfish::registries::heartbeat_event::registry,
24                               index, args);
25 }
26 
27 /**
28  * @brief Formats RedfishServiceFunctional message into JSON
29  * Message body: "Redfish service is functional."
30  *
31  * @returns Message RedfishServiceFunctional formatted to JSON */
32 inline nlohmann::json redfishServiceFunctional()
33 {
34     return getLogHeartbeat(
35         registries::heartbeat_event::Index::redfishServiceFunctional, {});
36 }
37 
38 } // namespace redfish::messages
39