#pragma once

#include <hei_main.hpp>

#include <algorithm>
#include <map>
#include <vector>

#include "gtest/gtest.h"

namespace libhei
{

/**
 * @brief Contains simulated chip objects and register contents used during
 *        isolation. Also contains the expected signatures to compare after
 *        isolation.
 */
class SimulatorData
{
  private: // This class cannot be instantiated. Use getSingleton() instead.
    /** @brief Default constructor. */
    SimulatorData() = default;

    /** @brief Destructor. */
    ~SimulatorData() = default;

    /** @brief Copy constructor. */
    SimulatorData(const SimulatorData&) = delete;

    /** @brief Assignment operator. */
    SimulatorData& operator=(const SimulatorData&) = delete;

  public:
    /** @brief Provides access to a singleton instance of this object. */
    static SimulatorData& getSingleton()
    {
        static SimulatorData theSimData{};
        return theSimData;
    }

  public:
    /** The list of supported chip types for the simulator. */
    enum SimChipType
    {
        SAMPLE = 0xdeadbeef,
        EXPLORER_11 = 0x60d20011,
        EXPLORER_20 = 0x60d20020,
        ODYSSEY_10 = 0x60c00010,
        P10_10 = 0x20da0010,
        P10_20 = 0x20da0020,
    };

  private:
    /** The Chip Data file paths for each support chip type. */
    static const std::map<SimChipType, const char*> cv_chipPath;

    /** The list of configured chips used throughout a test case. */
    std::vector<Chip> iv_chipList;

    /** The list of configured chip types used throughout a test case. */
    std::vector<ChipType_t> iv_typeList;

    /** The contents of all the SCOM registers used for an iteration of
     *  isolation. */
    std::map<Chip, std::map<uint32_t, uint64_t>> iv_scomRegData;

    /** The contents of all the Indirect SCOM registers used for an iteration of
     *  isolation. */
    std::map<Chip, std::map<uint64_t, uint64_t>> iv_idScomRegData;

    /** The list of expected signatures during an iteration of isolation. */
    std::vector<Signature> iv_expSigList;

  public:
    /**
     * @brief Adds a chip to the list of configured chips. Also, calls the main
     *        initialize() API which will initialize the isolator with the Chip
     *        Data File associated with this chip.
     */
    void addChip(const Chip& i_chip);

    /** @brief Retrieve ScomReg from map and return its value */
    uint64_t getScomReg(const Chip& i_chip, uint32_t i_address)
    {
        return iv_scomRegData[i_chip][i_address];
    }

    /** @breif Retrieve idScomReg from map and return its value */
    uint64_t getIdScomReg(const Chip& i_chip, uint64_t i_address)
    {
        return iv_idScomRegData[i_chip][i_address];
    }

    /** @brief Adds a SCOM register to iv_scomRegData. */
    void addScomReg(const Chip& i_chip, uint32_t i_address, uint64_t i_value)
    {
        // First check if this entry already exists.
        auto chip_itr = iv_scomRegData.find(i_chip);
        if (iv_scomRegData.end() != chip_itr)
        {
            auto addr_itr = chip_itr->second.find(i_address);
            ASSERT_EQ(chip_itr->second.end(), addr_itr);
        }

        // Add the new entry.
        iv_scomRegData[i_chip][i_address] = i_value;
    }

    /** @brief Adds a SCOM register to iv_idScomRegData. */
    void addIdScomReg(const Chip& i_chip, uint64_t i_address, uint64_t i_value)
    {
        // First check if this entry already exists.
        auto chip_itr = iv_idScomRegData.find(i_chip);
        if (iv_idScomRegData.end() != chip_itr)
        {
            auto addr_itr = chip_itr->second.find(i_address);
            ASSERT_EQ(chip_itr->second.end(), addr_itr);
        }

        // Add the new entry.
        iv_idScomRegData[i_chip][i_address] = i_value;
    }

    /** @brief Adds a Signature to iv_expSigList. */
    void addSignature(const Signature& i_signature)
    {
        // First check if this entry already exists.
        auto itr =
            std::find(iv_expSigList.begin(), iv_expSigList.end(), i_signature);
        ASSERT_EQ(iv_expSigList.end(), itr);

        // Add the new entry.
        iv_expSigList.push_back(i_signature);
    }

    /**
     * @brief Flushes register and expected signature lists used for a single
     *        isolation.
     */
    void flushIterationData()
    {
        iv_scomRegData.clear();
        iv_idScomRegData.clear();
        iv_expSigList.clear();
    }

    /** @brief Flushes all simulation data. */
    void flushAll()
    {
        flushIterationData();
        iv_chipList.clear();
        iv_typeList.clear();
    }

    /**
     * @brief After an iteration is set up with registers and expected
     *        signatures, this is called to run the simulation and verify the
     *        expected signatures.
     */
    void endIteration();
};

} // end namespace libhei

//------------------------------------------------------------------------------

// clang-format off

// The following macros can be used to simplify commonly used function for
// simulation test cases. At the core of each test case is a Google Test (i.e.
// gtest), which will do most of the error checking. Just like in gtest, a test
// case file can contain more than one test. Also, remember that this is all C++
// code. While it not likely to be used much, you can combine these macros with
// C++ code to do more advanced test cases. For example, you can put the
// iteration macros in a loop to walk through each bit of a register.

/**
 * This is the beginning of a test case. The NAME parameter must be valid C++
 * identifier and must not contain any underscores (per gtest requirement). To
 * end the test case use END_TEST_CASE. All contents of the test case must be
 * contain in between these two macros.
 */
#define START_TEST_CASE(NAME)                                                  \
    TEST(Simulator, NAME)                                                      \
    {                                                                          \
        libhei::SimulatorData& simData =                                       \
            libhei::SimulatorData::getSingleton();                             \
        simData.flushAll();                                                    \
        libhei::ChipType_t chipType;

/**
 * Use this to configure a chip object for the test case. There should be an
 * instance of this macro for each chip required for the test case. Note that
 * this will also call libhei::initialize() for each new chip type. The CHIP
 * parameter must be valid C++ identifier because it will be used as the name of
 * the chip variable. This same identifier will be re-used in several other
 * macros.
 */
#define CHIP(CHIP, TYPE)                                                       \
    chipType = static_cast<libhei::ChipType_t>(libhei::SimulatorData::TYPE);   \
    libhei::Chip CHIP{#CHIP, chipType};                                        \
    simData.addChip(CHIP);

/**
 * Once all of the chips have been configured, there can be one or more
 * iterations defined in the test case. Use END_ITERATION to end the iteration.
 * Note that register and signature information will be reset for each
 * iteration, however, the same set of configure chips will be used for all
 * iterations within the test case.
 */
#define START_ITERATION                                                        \
    {                                                                          \
        simData.flushIterationData();

/** This will add a SCOM register to the current iteration. */
#define REG_SCOM(CHIP, ADDR, VAL)                                              \
    simData.addScomReg(CHIP, static_cast<uint32_t>(ADDR),                      \
                       static_cast<uint64_t>(VAL));

/** This will add an Indirect SCOM register to the current iteration. */
#define REG_IDSCOM(CHIP, ADDR, VAL)                                            \
    simData.addIdScomReg(CHIP, static_cast<uint64_t>(ADDR),                    \
                         static_cast<uint64_t>(VAL));

/** This will add an expected signature to the current iteration. */
#define EXP_SIG(CHIP, ID, INST, BIT, TYPE)                                     \
    simData.addSignature(libhei::Signature{                                    \
        CHIP, static_cast<libhei::RegisterId_t>(ID),                           \
        static_cast<libhei::Instance_t>(INST),                                 \
        static_cast<libhei::BitPosition_t>(BIT), libhei::ATTN_TYPE_##TYPE});

/**
 * This is the end of an iteration that began with START_ITERATION. All of the
 * register contents and expected signatures will have been stored in the
 * simulation data. So, this will call libhei::isolate() with the list of
 * configured chips. Using the register contents in the simulation data,
 * libhei::isolate() will return a list of signatures (active attentions). That
 * list will be compared against the expected list of signatures stored in the
 * simulation data for test case verification.
 *
 * You will see that there are two gtest checks for failures:
 *  - The first check will look to see if any of the previous functions to add
 *    chips, registers, or signatures to the simulation data failed.
 *  - The second check will determine if isolation completed successfully and if
 *    all expected signatures have been verified.
 * If either check fails, the test case will be aborted regardless if there are
 * additional iterations in that test case. Note that failure in a test case
 * will not have any impact on subsequent test cases. Therefore, all test cases
 * in a file will at least be attempted even if there is a failure.
 */
#define END_ITERATION                                                          \
        if (HasFailure()) { simData.flushAll(); return; }                      \
        simData.endIteration();                                                \
        if (HasFailure()) { simData.flushAll(); return; }                      \
    }

/**
 * This is the end of the test case that started with START_TEST_CASE. It will
 * call libhei::uninitialize() and clean up the simulation data.
 */
#define END_TEST_CASE                                                          \
        libhei::uninitialize();                                                \
        simData.flushAll();                                                    \
    }

// clang-format on
