/*****************************************************************************
 * Copyright (c) 2023 MAK Technologies, Inc.
 * All rights reserved.
 *****************************************************************************/

//! \file DtTacticalGraphicsSettingsRecord.h
//! \brief Contains the DtTacticalGraphicsSettingsRecord class declaration.
//! \ingroup makArchives

#pragma once

#include <makArchives/makArchives.h>

namespace makArchives
{

   //! \brief Record class for tactical graphics settings
   //! \ingroup makArchives
   class DT_DLL_MAKARCHIVES DtTacticalGraphicsSettingsRecord
   {
   public:

      //! CTOR
      DtTacticalGraphicsSettingsRecord();

      DtTacticalGraphicsSettingsRecord(const DtTacticalGraphicsSettingsRecord& copy);

      DtTacticalGraphicsSettingsRecord& operator=(const DtTacticalGraphicsSettingsRecord& obj);

      //! DTOR
      ~DtTacticalGraphicsSettingsRecord(void);

      void setTacticalGraphicsEnabled(bool enabled);
      void setTacticalGraphicsIndicatorsEnabled(bool enabled);
      void setTacticalGraphicsHeightAboveTerrainLinesEnabled(bool enabled);
      void setTacticalGraphicsHeightAboveTerrainMode(unsigned mode);
      void setTacticalGraphicsHeightLinesEnabled(bool enabled);
      void setRemoteGraphicsEnabled(bool enabled);
      void setShowActiveTacticalGraphicsEnabled(bool enabled);

      bool tacticalGraphicsEnabled() const;
      bool tacticalGraphicsIndicatorsEnabled() const;
      bool tacticalGraphicsHeightAboveTerrainLinesEnabled() const;
      unsigned tacticalGraphicsHeightAboveTerrainMode() const;
      bool tacticalGraphicsHeightLinesEnabled() const;
      bool remoteGraphicsEnabled() const;
      bool showActiveTacticalGraphicsEnabled() const;
      bool deleteTacticalGraphicsOnHide() const;
      void setDeleteTacticalGraphicsOnHide( bool enabled );
      bool friendlyForceColorOverrideEnabled() const;
      void setFriendlyForceColorOverrideEnabled(bool enabled);
      bool friendlyForceColorOverrideIsBlack() const;
      void setFriendlyForceColorOverrideIsBlack(bool isBlack);

   protected:

      friend class boost::serialization::access;

      //! When the class Archive corresponds to an output archive, the
      //! & operator is defined similar to <<.  Likewise, when the class Archive
      //! is a type of input archive the & operator is defined similar to >>.
      template<class Archive> void serialize( Archive & ar, const unsigned int version )
      {
         if ( version != 3 )
         {
            ar & BOOST_SERIALIZATION_NVP(myTacticalGraphicsEnabled);
         }
         ar & BOOST_SERIALIZATION_NVP(myTacticalGraphicsIndicatorsEnabled);
      
         if(version >= 1)
         {
            if ( version != 3 )
            {
               ar & BOOST_SERIALIZATION_NVP(myTacticalGraphicsHeightAboveTerrainLinesEnabled);
            }
            ar & BOOST_SERIALIZATION_NVP(myTacticalGraphicsHeightAboveTerrainMode);
         }

         if(version >= 2 && version < 5 )
         {
            ar & BOOST_SERIALIZATION_NVP(myTacticalGraphicsIndicatorsOnSelectedEnabled);
         }

         if (version >= 6)
         {
            ar & BOOST_SERIALIZATION_NVP(myRemoteGraphicsEnabled);
         }

         if (version >= 7)
         {
            ar & BOOST_SERIALIZATION_NVP(myShowActiveTacticalGraphicsEnabled);
         }
         if (version >= 8)
         {
            ar & BOOST_SERIALIZATION_NVP(myDeleteTacticalGraphicsOnHide);
         }
         if (version >= 9)
         {
            ar & BOOST_SERIALIZATION_NVP(myFriendlyForceColorOverrideEnabled);
            ar & BOOST_SERIALIZATION_NVP(myFriendlyForceColorOverrideIsBlack);
         }

         if (version >= 10)
         {
            ar& BOOST_SERIALIZATION_NVP(myTacticalGraphicsHeightLinesEnabled);
         }
      }

   protected:

      bool myTacticalGraphicsEnabled;
      bool myTacticalGraphicsIndicatorsEnabled;
      bool myTacticalGraphicsIndicatorsOnSelectedEnabled;
      bool myTacticalGraphicsHeightAboveTerrainLinesEnabled;
      unsigned myTacticalGraphicsHeightAboveTerrainMode;
      bool myTacticalGraphicsHeightLinesEnabled;
      bool myRemoteGraphicsEnabled;
      bool myShowActiveTacticalGraphicsEnabled;
      bool myDeleteTacticalGraphicsOnHide;
      bool myFriendlyForceColorOverrideEnabled;
      bool myFriendlyForceColorOverrideIsBlack;
   };

}

BOOST_CLASS_VERSION( makArchives::DtTacticalGraphicsSettingsRecord, 10 )
