Moved Callout class logic to Resolution classes

This simplified the confusion between the Callout and Resolution classes
because there was a lot of overlap.

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: Iea0fb30a1577869ebfe5b2b195fee832a694adb5
diff --git a/analyzer/service_data.hpp b/analyzer/service_data.hpp
index 66e0200..c9f9c41 100644
--- a/analyzer/service_data.hpp
+++ b/analyzer/service_data.hpp
@@ -1,154 +1,12 @@
 #pragma once
 
+#include <analyzer/callout.hpp>
 #include <hei_main.hpp>
 #include <nlohmann/json.hpp>
 
 namespace analyzer
 {
 
-/** @brief An abstract class for service event, also known as a callout. */
-class Callout
-{
-  public:
-    /** Each callout will have a priority indicating when to issue the required
-     *  service action. Details below. */
-    enum Priority
-    {
-        /** Serivce is mandatory. */
-        HIGH,
-
-        /** Serivce medium priority callouts one at a time, in order, until the
-         *  issue is resolved. */
-        MED,
-
-        MED_A, ///< Same as PRI_MED, except replace all A's as a group.
-        MED_B, ///< Same as PRI_MED, except replace all B's as a group.
-        MED_C, ///< Same as PRI_MED, except replace all C's as a group.
-
-        /** If servicing all high and medium priority callouts did not resolve
-         *  the issue, service low priority callouts one at a time, in order,
-         *  until the issue is resolved. */
-        LOW,
-    };
-
-  public:
-    /** @brief Pure virtual destructor. */
-    virtual ~Callout() = 0;
-
-  protected:
-    /**
-     * @brief Constructor from components.
-     * @param p The callout priority.
-     */
-    explicit Callout(Priority p) : iv_priority(p) {}
-
-  private:
-    /** The callout priority. */
-    const Priority iv_priority;
-
-  protected:
-    /**
-     * @brief Appends the callout priority to the end of the given json object.
-     * @param j The json object for a single callout.
-     */
-    void addPriority(nlohmann::json& j) const
-    {
-        // clang-format off
-        static const std::map<Priority, std::string> m =
-        {
-            {HIGH,  "H"},
-            {MED,   "M"},
-            {MED_A, "A"},
-            {MED_B, "B"},
-            {MED_C, "C"},
-            {LOW,   "L"},
-        };
-        // clang-format on
-
-        j.emplace("Priority", m.at(iv_priority));
-    }
-
-  public:
-    /**
-     * @brief Appends a json object representing this callout to the end of the
-     *        given json object.
-     * @param j The json object containing all current callouts for a PEL.
-     */
-    virtual void getJson(nlohmann::json&) const = 0;
-};
-
-// Pure virtual destructor must be defined.
-inline Callout::~Callout() {}
-
-/** @brief A service event requiring hardware replacement. */
-class HardwareCallout : public Callout
-{
-  public:
-    /**
-     * @brief Constructor from components.
-     * @param i_locationCode The location code of the hardware callout.
-     * @param i_priority     The callout priority.
-     */
-    HardwareCallout(const std::string& i_locationCode, Priority i_priority) :
-        Callout(i_priority), iv_locationCode(i_locationCode)
-    {}
-
-  private:
-    /** The hardware location code. */
-    const std::string iv_locationCode;
-
-  public:
-    void getJson(nlohmann::json& j) const override
-    {
-        nlohmann::json c = {{"LocationCode", iv_locationCode}};
-        addPriority(c);
-        j.emplace_back(c);
-    }
-};
-
-/**
- * @brief A service event requiring a special procedure to be handled by a
- *        service engineer.
- */
-class ProcedureCallout : public Callout
-{
-  public:
-    /** Supported service procedures. */
-    enum Type
-    {
-        NEXTLVL, ///< Contact next level support.
-    };
-
-  public:
-    /**
-     * @brief Constructor from components.
-     * @param i_procedure The location code of the hardware callout.
-     * @param i_priority     The callout priority.
-     */
-    ProcedureCallout(Type i_procedure, Priority i_priority) :
-        Callout(i_priority), iv_procedure(i_procedure)
-    {}
-
-  private:
-    /** The callout priority. */
-    const Type iv_procedure;
-
-  public:
-    void getJson(nlohmann::json& j) const override
-    {
-        // clang-format off
-        static const std::map<Type, std::string> m =
-        {
-            {NEXTLVL, "NEXTLVL"},
-        };
-        // clang-format on
-
-        nlohmann::json c = {{"Procedure", m.at(iv_procedure)}};
-        addPriority(c);
-        j.emplace_back(c);
-    }
-};
-
 /**
  * @brief A service event requiring hardware to be guarded.
  */
@@ -232,7 +90,7 @@
     const bool iv_isCheckstop;
 
     /** The list of callouts that will be added to a PEL. */
-    std::vector<std::shared_ptr<Callout>> iv_calloutList;
+    nlohmann::json iv_calloutList = nlohmann::json::array();
 
     /** The list of hardware guard requests. Some information will be added to
      * the PEL, but the actual guard record will be created after submitting the
@@ -253,8 +111,11 @@
         return iv_isCheckstop;
     }
 
-    /** Add a callout to the list. */
-    void addCallout(const std::shared_ptr<Callout>& i_callout)
+    /**
+     * @brief Add callout information to the callout list.
+     * @param The JSON object for this callout.
+     */
+    void addCallout(const nlohmann::json& i_callout)
     {
         iv_calloutList.push_back(i_callout);
     }
@@ -265,19 +126,10 @@
         iv_guardList.push_back(i_guard);
     }
 
-    /**
-     * @brief Iterates the callout list and returns the json attached to each
-     *        callout in the list.
-     * @param o_json The returned json data.
-     */
-    void getCalloutList(nlohmann::json& o_json) const
+    /** @brief Accessor to iv_calloutList. */
+    const nlohmann::json& getCalloutList() const
     {
-        o_json.clear(); // Ensure we are starting with a clean list.
-
-        for (const auto& c : iv_calloutList)
-        {
-            c->getJson(o_json);
-        }
+        return iv_calloutList;
     }
 
     /**