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

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

#ifndef DtPropRecord_H_
#define DtPropRecord_H_

#include <makArchives/makArchives.h>

namespace makArchives
{
   //! \brief A DtPropRecord contains the information to recreate a prop.
   //! \ingroup makArchives
   class DT_DLL_MAKARCHIVES DtPropRecord
   {
   public:

      //! CTOR
      DtPropRecord();

      //! DTOR
      ~DtPropRecord();

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

      bool operator==(const DtPropRecord& orig) const;
      bool operator!=(const DtPropRecord& orig) const;

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

      //! Set the name of the prop.
      void setName(const std::string& name);

      //! Get the name of the prop.
      const std::string& name() const;

      //! Set position.
      void setPosition(double x, double y, double z);

      //! Get position.
      void getPosition(double& xOut, double& yOut, double& zOut) const;

      //! Set orientation (as quaternion).
      void setOrientation(double x, double y, double z, double w);

      //! Get orientation (as quaternion).
      void getOrientation(double& xOut, double& yOut, double& zOut, double& wOut) const;

      //! Set the prop type of this record.
      void setPropType(const std::string& propType);

      //! Return the prop type of this record.
      const std::string& propType() const;

      //! Set the model definition or node address of this record.
      void setModelDefOrNodeAddress(const std::string& modelDefOrNodeAddress);

      //! Return the model definition or node address of this record.
      const std::string& modelDefOrNodeAddress() const;

      //! Set whether modelDefOrNodeAddress() returns a model definition or node address. True is model def, false is node address.
      void setIsModelDef(bool bIsModelDef);

      //! Return whether modelDefOrNodeAddress() returns a model definition or node address. True is model def, false is node address.
      bool isModelDef() const;

      //! Set color
      void setColor(float r,float g, float b,float alpha);

      //! Get color
      void getColor(float& r,float& g, float& b,float& alpha) const;

      //! Set isVisible
      void setIsVisible(bool flag);

      //! Get isVisible
      bool isVisible() const;

   protected:

      //! Serialization/Deserialization //
      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)
      {
         ar & BOOST_SERIALIZATION_NVP(myName);
         ar & BOOST_SERIALIZATION_NVP(myPosX);
         ar & BOOST_SERIALIZATION_NVP(myPosY);
         ar & BOOST_SERIALIZATION_NVP(myPosZ);
         ar & BOOST_SERIALIZATION_NVP(myOrientationX);
         ar & BOOST_SERIALIZATION_NVP(myOrientationY);
         ar & BOOST_SERIALIZATION_NVP(myOrientationZ);
         ar & BOOST_SERIALIZATION_NVP(myOrientationW);
         ar & BOOST_SERIALIZATION_NVP(myPropType);
         ar & BOOST_SERIALIZATION_NVP(myModelDefOrNodeAddress);
         ar & BOOST_SERIALIZATION_NVP(myIsModelDefFlag);
         ar & BOOST_SERIALIZATION_NVP(myColorR);
         ar & BOOST_SERIALIZATION_NVP(myColorG);
         ar & BOOST_SERIALIZATION_NVP(myColorB);
         ar & BOOST_SERIALIZATION_NVP(myColorA);
         ar & BOOST_SERIALIZATION_NVP(myIsVisible);
      }

   protected:

      std::string myName;

      double myPosX;
      double myPosY;
      double myPosZ;
      double myOrientationX;
      double myOrientationY;
      double myOrientationZ;
      double myOrientationW;
      std::string myPropType;
      std::string myModelDefOrNodeAddress;
      bool myIsModelDefFlag;
      float myColorR;
      float myColorG;
      float myColorB;
      float myColorA;
      bool myIsVisible;

   };

   typedef std::vector<DtPropRecord> DtPropRecords;
}

#endif

