#include "fan_pwm.hpp"

#include "env.hpp"
#include "hwmon.hpp"
#include "hwmonio.hpp"
#include "sensorset.hpp"
#include "sysfs.hpp"

#include <phosphor-logging/elog-errors.hpp>
#include <xyz/openbmc_project/Control/Device/error.hpp>

#include <filesystem>
#include <format>
#include <string>

using namespace phosphor::logging;

namespace hwmon
{

uint64_t FanPwm::target(uint64_t value)
{
    using namespace std::literals;

    std::string empty;
    // Write target out to sysfs
    try
    {
        _ioAccess->write(value, _type, _id, empty, hwmonio::retries,
                         hwmonio::delay);
    }
    catch (const std::system_error& e)
    {
        using namespace sdbusplus::xyz::openbmc_project::Control::Device::Error;
        report<WriteFailure>(
            xyz::openbmc_project::Control::Device::WriteFailure::CALLOUT_ERRNO(
                e.code().value()),
            xyz::openbmc_project::Control::Device::WriteFailure::
                CALLOUT_DEVICE_PATH(_devPath.c_str()));

        auto file = sysfs::make_sysfs_path(_ioAccess->path(), _type, _id,
                                           empty);

        log<level::INFO>(std::format("Failing sysfs file: {} errno: {}", file,
                                     e.code().value())
                             .c_str());

        exit(EXIT_FAILURE);
    }

    return FanPwmObject::target(value);
}

} // namespace hwmon
