#pragma once

#include "internal/sys.hpp"
#include "window_hw_interface.hpp"

#include <cstdint>
#include <memory>
#include <utility>
#include <vector>

namespace ipmi_flash
{

class LpcMapperNuvoton : public HardwareMapperInterface
{
  public:
    static std::unique_ptr<HardwareMapperInterface> createNuvotonMapper(
        std::uint32_t regionAddress, std::uint32_t regionSize);

    /**
     * Create an LpcMapper for Nuvoton.
     *
     * @param[in] regionAddress - where to map the window into BMC memory.
     * @param[in] regionSize - the size to map for copying data.
     * @param[in] a sys call interface pointer.
     * @todo Needs reserved memory region's physical address and size.
     */
    LpcMapperNuvoton(std::uint32_t regionAddress, std::uint32_t regionSize,
                     const internal::Sys* sys = &internal::sys_impl) :
        regionAddress(regionAddress), memoryRegionSize(regionSize), sys(sys) {};

    /** Attempt to map the window for copying bytes, after mapWindow is called.
     * throws MapperException
     */
    MemorySet open() override;

    void close() override;

    WindowMapResult mapWindow(std::uint32_t address,
                              std::uint32_t length) override;

  private:
    std::uint32_t regionAddress;
    std::uint32_t memoryRegionSize;
    const internal::Sys* sys;

    /* The file handle to /dev/mem. */
    int mappedFd = -1;

    /* The pointer to the memory-mapped region. */
    std::uint8_t* mapped = nullptr;
};

} // namespace ipmi_flash
