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

#pragma once

#include "glmRTTI.h"
#include "glmBlendShapeGroupV0.h"

namespace glm
{
	struct AssetsGroupV0;
	struct ShaderGroupV0;
	struct GeometryGroupV0;
	struct RenderingTypeV1;

	struct AssetManagerV0;
	struct AssetManagerV1;
	struct AssetManagerV2;

	/**
	* \brief Character asset manager
	*/
	struct GLM_CORE_API AssetManagerV3
	{
		GLM_RTTI("c907d87c-c176-4e2e-9a99-5ca99ade5e3d", AssetManagerV3, addAttributes);
	public:

		GLM_CLASS_STAT_ID( glm::MemoryStatIds::GolaemShared);

		/// Name of the manager
		glm::GlmString _name;

		/// Asset groups
		glm::Array<AssetsGroupV0*> _assetGroups;

		/// Geometry group
		GeometryGroupV0* _geometryGroup;

		/// The mesh names and their associated shaders
		glm::GlmMap<glm::GlmString, glm::Array<ShaderGroupV0*> > _meshesShaderGroups;

		glm::Array<RenderingTypeV1*> _renderingTypes;

		AssetManagerV3();
		~AssetManagerV3();

		void findShaderGroups(const glm::GlmString& meshName, glm::PODArray<ShaderGroupV0*>& foundShaderGroups) const;
		void getAllShaderGroups(glm::PODArray<ShaderGroupV0*>& shaderGroups) const;

		/**
		* \brief V0 backwards compatibility
		*/
		void createFromV0(AssetManagerV0& assetManagerV0);

		/**
		* \brief V1 backwards compatibility
		*/
		void createFromV1(AssetManagerV1& assetManagerV1);

		/**
		* \brief V2 backwards compatibility
		*/
		void createFromV2(AssetManagerV2& assetManagerV2);

		void exportToV2(AssetManagerV2& assetManagerV2) const;
	protected:

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