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

//! \file DtWaterRipplesSettingsRecord.h
//! \brief Contains makArchives::DtWaterRipplesSettingsRecord class.
//! \ingroup makArchives

#pragma once
#include <makArchives/makArchives.h>

#include <string>
#include <vector>

namespace makArchives
{
   //! \brief A DtWaterRipplesSettingsRecord contains the information for water ripples
   //! settings that the applications loads/saves.
   //! \ingroup makArchives
   class DT_DLL_MAKARCHIVES DtWaterRipplesSettingsRecord
   {
   public:

      struct PresetInfo
      {
         template<class Archive>
         void serialize(Archive& ar, const unsigned int /*version*/)
         {
            ar& BOOST_SERIALIZATION_NVP(myFlags);
            ar& BOOST_SERIALIZATION_NVP(myTextureSize);
            ar& BOOST_SERIALIZATION_NVP(myFrequency);
            ar& BOOST_SERIALIZATION_NVP(myOctaves);
            ar& BOOST_SERIALIZATION_NVP(myRidgeStrength);
            ar& BOOST_SERIALIZATION_NVP(myWorleyCells);
            ar& BOOST_SERIALIZATION_NVP(myWorleyBlend);
            ar& BOOST_SERIALIZATION_NVP(myAmplitude);
            ar& BOOST_SERIALIZATION_NVP(myTileRateMeters);
            ar& BOOST_SERIALIZATION_NVP(mySpeed);
            ar& BOOST_SERIALIZATION_NVP(mySpecularPower);
            ar& BOOST_SERIALIZATION_NVP(mySpecularMultiplier);
            ar& BOOST_SERIALIZATION_NVP(myColorR);
            ar& BOOST_SERIALIZATION_NVP(myColorG);
            ar& BOOST_SERIALIZATION_NVP(myColorB);
            ar& BOOST_SERIALIZATION_NVP(myName);
         }

         // Flags is used at runtime to indicate which parameters to apply (bitmask).
         int myFlags = 1;

         int myTextureSize = 512;
         float myFrequency = 8.0f;
         int myOctaves = 4;
         float myRidgeStrength = 1.0f;
         int myWorleyCells = 8;
         float myWorleyBlend = 0.8f;
         float myAmplitude = 4.0f;
         float myTileRateMeters = 128.0f;
         float mySpeed = 2.0f;
         float mySpecularPower = 0.9f;
         float mySpecularMultiplier = 0.2f;
         float myColorR = 0.0f;
         float myColorG = 0.18f;
         float myColorB = 0.28f;
         std::string myName;
      };

      //! CTOR
      DtWaterRipplesSettingsRecord();

      //! Copy CTOR
      DtWaterRipplesSettingsRecord(const DtWaterRipplesSettingsRecord& orig);

      //! DTOR
      ~DtWaterRipplesSettingsRecord();

      //! Assignment OP
      DtWaterRipplesSettingsRecord& operator=(DtWaterRipplesSettingsRecord rhs);

      //! Swap data from this object with another.
      void swap(DtWaterRipplesSettingsRecord& other);

      //!@{
      const std::vector<DtWaterRipplesSettingsRecord::PresetInfo>& presets() const;
      void setPresets(const std::vector<DtWaterRipplesSettingsRecord::PresetInfo>& presets);
      //!@}

   protected:

      // Static utility to swap two PresetInfo objects
      static void swapPresetInfo(PresetInfo& a, PresetInfo& b);

   protected:

      //! Serialization
      friend class boost::serialization::access;

      template<class Archive>
      void serialize(Archive& ar, const unsigned int version)
      {
         ar& BOOST_SERIALIZATION_NVP(myPresets);
      }

   protected:

      std::vector<DtWaterRipplesSettingsRecord::PresetInfo> myPresets;
   };
}

BOOST_CLASS_VERSION(makArchives::DtWaterRipplesSettingsRecord, 0)
