#pragma once

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

namespace field_qa {

class RunStats {
 public:
  void begin(uint32_t nowMs);
  void updateFromSample(const GnssSample& sample, uint32_t nowMs);
  uint32_t elapsedMs(uint32_t nowMs) const;
  uint32_t longestNoFixMs() const;
  uint32_t ttffMs() const;
  bool hasFirstFix() const;

 private:
  uint32_t m_bootMs = 0;
  uint32_t m_noFixStartMs = 0;
  uint32_t m_longestNoFixMs = 0;
  uint32_t m_ttffMs = 0;
  bool m_started = false;
  bool m_haveFirstFix = false;
};

}  // namespace field_qa

