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

 
//! \file DtTerrainOperationRecord.h 
//! \brief Contains makVrv::DtTerrainOperationRecord class. 
//! \ingroup makArchives
 
#pragma once

#include <makArchives/makArchives.h> 
 
namespace makArchives 
{ 
   //! \brief A DtTerrainOperationRecord contains information about a single terrain operation.
   //! \ingroup makArchives
   class DT_DLL_MAKARCHIVES DtTerrainOperationRecord 
   { 

   public:

      enum OperationType { NoOp, Add };
      enum InputType { NoInput, Patch, FeatureLayer, OceanLayer, Generic };
      enum TargetApplication { 
         NoApplication, 
         Visualization, 
         Simulation,
         VisualizationAndSimulation
      };

      //! \brief CTOR
      DtTerrainOperationRecord();

      //! \brief Copy CTOR
      DtTerrainOperationRecord(const DtTerrainOperationRecord& orig);

      //! \brief Assignment OP
      DtTerrainOperationRecord& operator=(const DtTerrainOperationRecord& orig);

      //! \brief DTOR
      ~DtTerrainOperationRecord();

      //! Test for equality.
      bool operator==(const DtTerrainOperationRecord& record) const;

      //! \brief Set OperationType.
      void setOperationType(OperationType opType);

      //! \brief Get OperationType.
      OperationType operationType() const;

      //! \brief Set InputType.
      void setInputType(InputType inType);

      //! \brief Get OperationType.
      InputType inputType() const;

      //! \brief Set TargetApplication.
      void setTargetApplication(TargetApplication targetApplication);

      //! \brief Get TargetApplication.
      TargetApplication targetApplication() const;

      //! \brief Set index.
      void setIndex(int index);

      //! \brief Get index.
      int index() const;

   protected:

      void updateInternalEnumerationsBasedOnStrings();
      void updateInternalStringsBasedOnEnumerations();

      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 < 2)
            {
               ar & BOOST_SERIALIZATION_NVP(myOperationType);
               ar & BOOST_SERIALIZATION_NVP(myInputType);
               if (version > 0)
               {
                  ar & BOOST_SERIALIZATION_NVP(myTargetApplication);
               }
               updateInternalStringsBasedOnEnumerations();
            }
            else
            {
               ar & BOOST_SERIALIZATION_NVP(myOperationTypeString);
               ar & BOOST_SERIALIZATION_NVP(myInputTypeString);
               ar & BOOST_SERIALIZATION_NVP(myTargetApplicationString);
               updateInternalEnumerationsBasedOnStrings();
            }
            ar & BOOST_SERIALIZATION_NVP(myIndex);
      }


   protected:

      OperationType myOperationType;
      InputType myInputType;
      TargetApplication myTargetApplication;
      
      std::string myOperationTypeString;
      std::string myInputTypeString;
      std::string myTargetApplicationString;
      int myIndex;


   }; 
} 

BOOST_CLASS_VERSION(makArchives::DtTerrainOperationRecord, 2)

 
