#pragma once

#include <chrono>
#include <exception>
#include <fstream>
#include <string>

namespace sysfs
{

inline std::string make_sysfs_path(const std::string& path,
                                   const std::string& type,
                                   const std::string& id,
                                   const std::string& entry)
{
    using namespace std::literals;

    if (entry.empty())
    {
        return path + "/"s + type + id;
    }

    return path + "/"s + type + id + "_"s + entry;
}

/** @brief Return the path to the phandle file matching value in io-channels.
 *
 *  This function will take two passed in paths.
 *  One path is used to find the io-channels file.
 *  The other path is used to find the phandle file.
 *  The 4 byte phandle value is read from the phandle file(s).
 *  The 4 byte phandle value and 4 byte index value is read from io-channels.
 *  When a match is found, the path to the matching phandle file is returned.
 *
 *  @param[in] iochanneldir - Path to file for getting phandle from io-channels
 *  @param[in] phandledir - Path to use for reading from phandle file
 *
 *  @return Path to phandle file with value matching that in io-channels
 */
std::string findPhandleMatch(const std::string& iochanneldir,
                             const std::string& phandledir);

/** @brief Find hwmon instances from an open-firmware device tree path
 *
 *  Look for a matching hwmon instance given an
 *  open firmware device path.
 *
 *  @param[in] ofNode- The open firmware device path.
 *
 *  @returns[in] - The hwmon instance path or an empty
 *                 string if no match is found.
 */
std::string findHwmonFromOFPath(std::string ofNode);

/** @brief Find hwmon instances from a device path
 *
 *  Look for a matching hwmon instance given a device path that
 *  starts with /devices.  This path is the DEVPATH udev attribute
 *  for the device except it has the '/hwmon/hwmonN' stripped off.
 *
 *  @param[in] devPath - The device path.
 *
 *  @return - The hwmon instance path or an empty
 *            string if no match is found.
 */
std::string findHwmonFromDevPath(std::string devPath);

/** @brief Return the path to use for a call out.
 *
 *  Return an empty string if a callout path cannot be
 *  found.
 *
 *  @param[in] instancePath - /sys/class/hwmon/hwmon<N> path.
 *
 *  @return Path to use for call out
 */
std::string findCalloutPath(const std::string& instancePath);

} // namespace sysfs

// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
