#pragma once

#include "associations.hpp"
#include "types.hpp"

#include <boost/container/flat_map.hpp>
#include <boost/container/flat_set.hpp>

#include <cassert>
#include <string>

/** @brief Define allow list and deny list data structure */
using AllowDenyList = boost::container::flat_set<std::string>;

/** @brief The associations definitions interface */
constexpr const char* assocDefsInterface =
    "xyz.openbmc_project.Association.Definitions";

/** @brief The associations definitions property name */
constexpr const char* assocDefsProperty = "Associations";

/** @brief InterfacesAdded represents the dbus data from the signal
 *
 * There are 2 pairs
 * pair1: D-bus Interface,vector[pair2]
 * pair2: D-bus Method,vector[Associations]
 */
using InterfacesAdded = std::vector<std::pair<
    std::string, std::vector<std::pair<
                     std::string, std::variant<std::vector<Association>>>>>>;

/** @brief Get well known name of input unique name
 *
 * If user passes in well known name then that will be returned.
 *
 * @param[in] owners       - Current list of owners
 * @param[in] request      - The name to look up
 * @param[out] wellKnown   - The well known name if found
 *
 * @return True if well known name is found, false otherwise
 */
bool getWellKnown(
    const boost::container::flat_map<std::string, std::string>& owners,
    const std::string& request, std::string& wellKnown);

/** @brief Determine if dbus service is something to monitor
 *
 * mapper supports an allowlist concept. If an allowlist is provided as input
 * then only dbus objects matching that list is monitored.
 *
 * @param[in] processName   - Dbus service name
 * @param[in] allowList     - The allow list
 *
 * @return True if input processName should be monitored, false otherwise
 */
bool needToIntrospect(const std::string& processName,
                      const AllowDenyList& allowList);

/** @brief Handle the removal of an existing name in objmgr data structures
 *
 * @param[in,out] nameOwners      - Map of unique name to well known name
 * @param[in]     wellKnown       - Well known name that has new owner
 * @param[in]     oldOwner        - Old unique name
 * @param[in,out] interfaceMap    - Map of interfaces
 * @param[in,out] assocMaps       - The association maps
 * @param[in,out] server          - sdbus system object
 *
 */
void processNameChangeDelete(
    boost::container::flat_map<std::string, std::string>& nameOwners,
    const std::string& wellKnown, const std::string& oldOwner,
    InterfaceMapType& interfaceMap, AssociationMaps& assocMaps,
    sdbusplus::asio::object_server& server);

/** @brief Handle an interfaces added signal
 *
 * @param[in,out] interfaceMap    - Global map of interfaces
 * @param[in]     objPath         - New path to process
 * @param[in]     interfacesAdded - New interfaces to process
 * @param[in]     wellKnown       - Well known name that has new owner
 * @param[in,out] assocMaps       - The association maps
 * @param[in,out] server          - sdbus system object
 *
 */
void processInterfaceAdded(InterfaceMapType& interfaceMap,
                           const sdbusplus::message::object_path& objPath,
                           const InterfacesAdded& intfAdded,
                           const std::string& wellKnown,
                           AssociationMaps& assocMaps,
                           sdbusplus::asio::object_server& server);
