/***************************************************************************
*                                                                          *
*  Copyright (C) Golaem S.A.  All Rights Reserved.                         *
*                                                                          *
****************************************************************************/

#pragma once

#include "glmRTTI.h"
#include "glmTypes.h"

#include <glmGolaemCharacterDeclarations.h> // GolaemCharacter declarations

namespace glm
{
    struct WeightOverrideV0;
    struct RenderingTypeV3;

    struct GLM_CORE_API WeightOverrideV1
    {
        GLM_RTTI("3a6ddc4e-5793-4677-9578-e48098aa4c9c", WeightOverrideV1, addAttributes);

    public:
        GLM_CLASS_STAT_ID( glm::MemoryStatIds::GolaemShared);

        int _assetIndex = 0;
        glm::PODArray<float> _weights;
        WeightOverrideType::Value _type = WeightOverrideType::GROUP;

        /**
		* \brief V0 backwards compatibility
		* \note V0 does not have a type, was only for groups
		*/
        void createFromV0(const WeightOverrideV0& weightOverrideV0);

    protected:
        /**
		* \brief Inspection needed method declaring the inspectable attributes.
		*/
        static void addAttributes();

        /**
		* \brief Accessor to the type needed for inspection
		*/
        int getTypeAsInt() const;
        void setTypeFromInt(int value);
    };

    /**
	* \brief Crowd Rendering Type
	*/
    class GLM_CORE_API RenderingTypeV4
    {
        GLM_RTTI("cd244854-c55f-407f-8a7d-567b5825f62d", RenderingTypeV4, addAttributes)
    public:
        GLM_CLASS_STAT_ID( glm::MemoryStatIds::GolaemShared);

        /// The name of the rendering type
        glm::GlmString _name;
        glm::Array<WeightOverrideV1> _weightOverrides;
        int _parentRenderingType = -1;

        RenderingTypeV4();
        ~RenderingTypeV4();

        /**
		* \brief V3 backwards compatibility
		* \note V3 uses WeightOverrideV0
		*/
        void createFromV3(const RenderingTypeV3& renderingTypeV3);

        static void computeChildRenderingTypes(glm::PODArray<int>& childRenderingTypes, int renderingTypeIdx, const glm::Array<RenderingTypeV4>& renderingTypes);

    protected:
        /**
		* \brief Inspection needed method declaring the inspectable attributes.
		*/
        static void addAttributes();
    };
} // namespace glm
