Add Persistent Heartbeat subscription properties

This adds Heartbeat parameters to subscriptions so that the future
heartbeat implementation can use those parameters specified by the
schema [1][2][3].
- SendHeartbeat
- HeartbeatIntervalMinutes

Tested:

1. POST Subscription
- Create a subscription (e.g. via Redfish-Event-Listener) or like

```
curl -k  -H "Content-Type: application/json" -X POST https://${bmc}/redfish/v1/EventService/Subscriptions \
 -d '{
  "Context": "Public",
  "DeliveryRetryPolicy": "TerminateAfterRetries",
  "Destination": "https://DESTINATION-IPADDR/Redfish-Evt-Listener",
  "EventFormatType": "Event",
  "HeartbeatIntervalMinutes": 2,
  "HttpHeaders": [],
  "MessageIds": [],
  "MetricReportDefinitions": [],
  "Protocol": "Redfish",
  "RegistryPrefixes": [],
  "ResourceTypes": [],
  "SendHeartbeat": true,
  "SubscriptionType": "RedfishEvent",
  "VerifyCertificate": true
}'
```

2. GET the subscription and check the content
```
SUBID=<id>
curl -k -X GET https://${bmc}/redfish/v1/EventService/Subscriptions/${SUBID}
```

3. PATCH Subscription
- PATCH with various SendHeartbeat & HeartbeatIntervalMinutes

For example,
```
curl -k -X PATCH https://${bmc}/redfish/v1/EventService/Subscriptions/${SUBID} \
    -H "Content-Type: application/json" \
     -d '{"SendHeartbeat":true, "HeartbeatIntervalMinutes":10}'
```

- Restart bmcweb or reboot BMC

- Get the subscription data and see whether the heartbeat properties are
  persistent.

4. Redfish Validator Service passes

[1] https://github.com/openbmc/bmcweb/blob/d109e2b60f7bb367dc8115475c6cb86bca6e1914/redfish-core/schema/dmtf/json-schema/EventDestination.v1_15_0.json#L356
[2] https://github.com/openbmc/bmcweb/blob/d109e2b60f7bb367dc8115475c6cb86bca6e1914/redfish-core/schema/dmtf/json-schema/EventDestination.v1_15_0.json#L222
[3] https://www.dmtf.org/sites/default/files/standards/documents/DSP2046_2022.3.html

Change-Id: I9e7feadb2e851ca320147df2231f65ece58ddf25
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
diff --git a/include/event_service_store.hpp b/include/event_service_store.hpp
index b0a1d97..ffbb389 100644
--- a/include/event_service_store.hpp
+++ b/include/event_service_store.hpp
@@ -7,6 +7,7 @@
 #include <boost/url/url.hpp>
 #include <nlohmann/json.hpp>
 
+#include <limits>
 #include <memory>
 #include <string>
 #include <vector>
@@ -22,6 +23,10 @@
     std::string protocol;
     bool verifyCertificate = true;
     std::string retryPolicy;
+    bool sendHeartbeat = false;
+    // This value of hbIntervalMinutes is just a reasonable default value and
+    // most clients will update it if sendHeartbeat is turned on
+    uint64_t hbIntervalMinutes = 10;
     std::string customText;
     std::string eventFormatType;
     std::string subscriptionType;
@@ -93,6 +98,25 @@
                 }
                 subvalue.retryPolicy = *value;
             }
+            else if (element.first == "SendHeartbeat")
+            {
+                const bool* value = element.second.get_ptr<const bool*>();
+                if (value == nullptr)
+                {
+                    continue;
+                }
+                subvalue.sendHeartbeat = *value;
+            }
+            else if (element.first == "HeartbeatIntervalMinutes")
+            {
+                const uint64_t* value =
+                    element.second.get_ptr<const uint64_t*>();
+                if (value == nullptr || *value < 1 || *value > 65535)
+                {
+                    continue;
+                }
+                subvalue.hbIntervalMinutes = *value;
+            }
             else if (element.first == "Context")
             {
                 const std::string* value =