#ifndef _INA219
#define _INA219

#include "ForteSensor.hpp"
#include "Message.hpp"
#include "Pinout.hpp"
#include "Wire.h"
#include "esp_log.h"
#include <INA219_WE.h>
#include <MeasurementTypes.h>


struct out_data_ina219 {
  float shuntVoltage_mV = 0.0;
  float loadVoltage_V = 0.0;
  float busVoltage_V = 0.0;
  float current_mA = 0.0;
  float power_mW = 0.0;
  bool ina219_overflow = false;
};

class ForteINA219: public ForteSensor<out_data_ina219> {
 public:
  void setup() override;
  out_data_ina219 readData() override;
  std::list<Message> buildMessages() override;
  [[nodiscard]] SensorInformation getSensorInformation() const override;

 private:
  INA219_WE ina219;
  out_data_ina219 data;
  const SensorInformation
      sensorInformation{HardwareName::INA219, SensorProtocol::I2C};

};

#endif