#ifndef RESOLVER_DEFAULT_HPP
#define RESOLVER_DEFAULT_HPP
//----------------------------------------------------------------------------
///
/// \file   resolverDefault.h
///
/// \brief  See implementation for further details
///
/// \date   20230329
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//----------------------------------------------------------------------------


//---Documentation------------------------------------------------------------


//---Includes -----------------------------------------------------------------


//---General--------------------------


//---Own------------------------------

#include "app.h"


//--- Declaration -------------------------------------------------------------


class CResolverDefault
{
   private:

      CApp *m_pApp;
      CBoard *m_pBoard;
      QStringList m_predefined;
      QString m_lastUnresolvable;
      int m_pos=0;
		// Tests and aplications pass with 2000
      static constexpr int RESERVE_PERIPHERY=8000;

   public:
      CResolverDefault(CApp *app, CBoard *board);
      CPeripheryPtr resolveReference(CReference &reference, const CReference &rootReference);
      CPeripheryPtr resolveReference(CReference &reference, const CReference &rootReference, const QString &group);
      bool resolveConsumes(CPeriphery &periphery, const CReference &rootReference);
      bool resolveConsumes(CPeriphery &periphery, const CReference &rootReference, const QString &group);
      void errorExit(QString message)
      {
         qCritical( "%s", qPrintable(message) );
         throw(message);
      }
      void checkFabricate( CPeriphery &periphery );
      bool skipConsume(const CPeriphery &periphery, const CReference &reference);
      const QString &getLastUnresolvable()
      {
         return(m_lastUnresolvable);
      }
};


//---fin----------------------------------------------------------------------
#endif // ? ! RESOLVER_PREDEFINED_HPP
