#ifndef SSRREFSIG_H
#define SSRREFSIG_H

#include <QtCore>
#include "bncconst.h"

// Reference signals of the satellite clocks per GNSS (IGS conventions):
// the clocks refer to the ionosphere-free combination of the code signals
// of these two signals. Used by the combination (referring the AC clocks,
// code biases from a Bias SINEX file) and the SSR QC (B_IF, stream
// comparison). Default 'G:1W&2W R:1P&2P E:1C&5Q C:2I&6I J:1C&2L S:1C&5Q',
// systems can be overwritten with the option ssrRefSignals.
////////////////////////////////////////////////////////////////////////////
class t_ssrRefSig {
 public:
  class t_pair {
   public:
    t_pair() : frq1(t_frequency::dummy), frq2(t_frequency::dummy), att1('_'), att2('_') {}
    t_frequency::type frq1;
    t_frequency::type frq2;
    char              att1;
    char              att2;
    std::string sig1() const;  // e.g. "1W"
    std::string sig2() const;
  };

  // (Re-)read the option ssrRefSignals; returns the messages about invalid
  // entries (these systems keep their default)
  static QStringList init();

  static bool    get(char sys, t_pair& pair);
  static bool    isDefault(char sys);
  static bool    allDefault();
  static QString defaultString();
  static QString currentString();

 private:
  static bool parse(const QString& str, QMap<char, t_pair>& pairs, QStringList* errors);
  static QMutex              _mutex;
  static bool                _initialized;
  static QMap<char, t_pair>  _pairs;
};

#endif
