/******************************************************************************
** Copyright (c) 2024 MAK Technologies, Inc.
** All rights reserved.
******************************************************************************/
//! \brief Utility class to manage CDB Material Substrate
//! \ingroup osgearth_cdb_utils
#pragma once
#include <osgearth_cdb_utils/DtCDBBaseMaterial.h>
#include <algorithm>
#include <vector>

namespace makVrv { namespace oe { namespace CDB {

   //! \brief CDB Base Material class. Hold Base Material name / description
   //! \ingroup osgearth_cdb_utils
   class DT_DLL_OSGEARTH_CDB_UTILS DtCDBSubstrate : public osg::Referenced
   {
   public:

      //! \brief CTOR
      DtCDBSubstrate();
      //! \brief DTOR
      virtual ~DtCDBSubstrate();
      //! \brief Read Substrate from an xml node
      bool readXmlNode(osgDB::XmlNode::Children::iterator& subIter);
      //! \brief Get number of base material in the Primary substrate
      unsigned int getNumberOfBaseMaterialInPrimarySubstrate() const;
      //! \brief Get the base material name at that index based on weight percentage
      std::string getBaseMaterial(unsigned int index) const;
      //! \brief Get the percentage of the first primary material
      unsigned int getBaseMaterialWeight(unsigned int index) const;
 

   protected:


   private:
      //! \brief Substrate Thickness (in meters)
      float myThickness;
      //! \brief Ordered list of base material in the substrate
      std::vector<DtCDBBaseMaterial> myMaterialList;

   };


}}} // namespace mak::osgEarth::CDB

