#include "GnssTypes.h"
#include "Config.h"

namespace field_qa {

const char* fixTypeToString(FixType type) {
  switch (type) {
    case FixType::Fix2D:
      return "2D";
    case FixType::Fix3D:
      return "3D";
    case FixType::Dgps:
      return "DGPS";
    case FixType::RtkFloat:
      return "RTK_FLOAT";
    case FixType::RtkFixed:
      return "RTK_FIXED";
    case FixType::NoFix:
    default:
      return "NO_FIX";
  }
}

const char* qualityClassForSample(const GnssSample& sample) {
  if (!sample.validFix || sample.fixDimension < 2 || sample.satsUsed < (int)kPoorMinSatsUsed ||
      (!sample.validHdop && sample.fixDimension < 3)) {
    return "POOR";
  }
  if (sample.fixDimension < 3 || sample.satsUsed < (int)kGoodMinSatsUsed ||
      (sample.validHdop && sample.hdop >= kMarginalHdop)) {
    return "MARGINAL";
  }
  if (sample.fixDimension >= 3 && sample.satsUsed >= (int)kExcellentMinSatsUsed &&
      sample.validHdop && sample.hdop < kExcellentHdop) {
    return "EXCELLENT";
  }
  return "GOOD";
}

}  // namespace field_qa

