#pragma once

#include <Arduino.h>
#include <U8g2lib.h>
#include "GnssTypes.h"
#include "RunStats.h"

namespace field_qa {

class DisplayManager {
 public:
  void begin();
  void showBoot(const char* line2,
                const char* line3 = nullptr,
                const char* line4 = nullptr,
                const char* batteryText = nullptr);
  void showError(const char* line1, const char* line2 = nullptr);
  void showSample(const GnssSample& sample, const RunStats& stats, bool recording, const char* batteryText);
  void setPowerSave(bool enabled);
  bool powerSave() const;

 private:
  void drawLines(const char* l1,
                 const char* l2 = nullptr,
                 const char* l3 = nullptr,
                 const char* l4 = nullptr,
                 const char* l5 = nullptr,
                 const char* l6 = nullptr);

  U8G2_SH1106_128X64_NONAME_F_HW_I2C m_oled{U8G2_R0, U8X8_PIN_NONE};
  bool m_powerSave = false;
};

}  // namespace field_qa
