#ifndef LIBOCELLI_SCREEN_SETTINGS_HPP
#define LIBOCELLI_SCREEN_SETTINGS_HPP
//----------------------------------------------------------------------------
///
/// \brief   Navigation screen
///
///
/// \date   20230106
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//----------------------------------------------------------------------------


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


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

#include <ctype.h>     // strupr

#include <ocelli/screen.hpp>
#include <ocelli/buttonSwitch.h>
#include <biwak/gdisplay.h>
#include <candisConfig.hpp>
#include "git_version.h"
#include <settings.h>
//#include <campo/vagus.hpp>


#if 0

struct SEepromConfigCustom{
   int foo;
   char interface;
   struct
   {
      int periodicSyncRtc;
      bool screensaver;
      bool totalOff;
   }fields;

   void dump() const;
};
#endif


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


class CScreenSettings: public OScreen
{
   private:
      SEepromConfigCustom &m_config;
      //int       m_interface=0;
      OButton   *m_pButtonInterface;
      OButtonSwitch   *m_pButtonRtcSync;
      OButtonSwitch   *m_pButtonTotalOff;
      OButtonSwitch   *m_pButtonScreenSaver;
      static constexpr const char *m_interfaceStrings[]{"USB", "CAN"};

   public:
      CSignal <void> signalSettingsChanged;

      CScreenSettings( SEepromConfigCustom &config );
      virtual void draw() override;

      void slotInterfacePressed(const Ocelli::SEvent& event)
      {
         // ++ CUSTOM_CONFIG( interface );
         m_pButtonInterface->setText( m_interfaceStrings[(int)m_config.interface] );
         m_pButtonInterface->draw();
         slotConfigChanged(event);
      }

      void slotConfigChanged(const Ocelli::SEvent& event)
      {
         //CUSTOM_CONFIG( fields.periodicSyncRtc ) = m_pButtonRtcSync->getValue();
         //CUSTOM_CONFIG( fields.screensaver ) = m_pButtonScreenSaver->getValue();
         //CUSTOM_CONFIG( fields.totalOff ) = m_pButtonTotalOff->getValue();
         signalSettingsChanged.emitSignal();
      }
};


//---fin----------------------------------------------------------------------
#endif // ? ! LIBOCELLI_SCREEN_SETTINGS_HPP
