/*
 * SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION &
 * AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: Apache-2.0
 */

#pragma once

#include "Inventory.hpp"
#include "MctpRequester.hpp"
#include "NvidiaDeviceDiscovery.hpp"
#include "NvidiaGpuPowerSensor.hpp"
#include "NvidiaGpuSensor.hpp"

#include <NvidiaGpuEnergySensor.hpp>
#include <NvidiaGpuVoltageSensor.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/steady_timer.hpp>
#include <sdbusplus/asio/connection.hpp>
#include <sdbusplus/asio/object_server.hpp>

#include <chrono>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>

class GpuDevice
{
  public:
    GpuDevice(const SensorConfigs& configs, const std::string& name,
              const std::string& path,
              const std::shared_ptr<sdbusplus::asio::connection>& conn,
              uint8_t eid, boost::asio::io_context& io,
              mctp::MctpRequester& mctpRequester,
              sdbusplus::asio::object_server& objectServer);

    const std::string& getPath() const
    {
        return path;
    }

  private:
    void makeSensors();

    void read();

    void processTLimitThresholds(uint8_t rc,
                                 const std::vector<int32_t>& thresholds);

    uint8_t eid{};

    std::chrono::milliseconds sensorPollMs;

    boost::asio::steady_timer waitTimer;

    mctp::MctpRequester& mctpRequester;

    std::shared_ptr<sdbusplus::asio::connection> conn;

    sdbusplus::asio::object_server& objectServer;

    std::shared_ptr<NvidiaGpuTempSensor> tempSensor;
    std::shared_ptr<NvidiaGpuTempSensor> tLimitSensor;
    std::shared_ptr<NvidiaGpuTempSensor> dramTempSensor;
    std::shared_ptr<NvidiaGpuPowerSensor> powerSensor;
    std::shared_ptr<NvidiaGpuEnergySensor> energySensor;
    std::shared_ptr<NvidiaGpuVoltageSensor> voltageSensor;

    SensorConfigs configs;

    std::string name;

    std::string path;

    std::shared_ptr<Inventory> inventory;
};
