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

#pragma once

#include "glmCoreAPI.h"
#include "glmRTTI.h"
#include "glmAssetGroupV1.h"
#include "glmMeshAssetV4.h"
#include "glmGeometryAssetV3.h"
#include "glmShadingGroup.h"
#include "glmRenderingType.h"
#include "glmGenericSpecificConverterMappingV7.h"
#include "glmCharacterUserData.h"
#include "glmShaderAsset.h"
#include "glmShaderAttributeV2.h"
#include "glmClothAsset.h"
#include "glmGolaemCharacterBlindDataOverride.h"
#include "glmGolaemCharacterSkeletonOverride.h"
#include "glmGolaemCharacterInterface.h"

namespace glm
{
    struct GolaemCharacterV15;

    struct GLM_CORE_API GolaemCharacterV16 : public GolaemCharacterInterface
    {
        GLM_VIRTUAL_RTTI("5899056d-4a50-4784-997b-415368342b47", glm::GolaemCharacterV16, addAttributes);

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

        /// Name of the character
        glm::GlmString _name;
        int _fileVersion;

        glm::PODArray<int> _mainAssetGroups;
        glm::PODArray<int> _mainShaderAttributes;

        glm::Array<AssetGroupV1> _allAssetGroups;
        glm::Array<MeshAssetV4> _meshAssets;

        glm::GlmMap<short, glm::Array<GeometryAssetV3>> _geometryAssetsPerTags;

        glm::Array<ShadingGroupV1> _shadingGroups;

        glm::Array<ShaderAttributeV2> _shaderAttributes;

        glm::Array<ShaderAssetV2> _shaderAssets;

        glm::Array<RenderingTypeV4> _renderingTypes;

        GenericSpecificConverterMappingV7 _converterMapping; // animation data
        CharacterUserDataV0 _characterUserData;              // additional user data

        Array<SkeletonOverrideV0> _skeletonOverrides;
        Array<BlindDataOverrideV0> _blindDataOverrides;

        GolaemCharacterV16();
        ~GolaemCharacterV16();

        /**
		* \brief V15 backwards compatibility
		* \note V16 adds data to shader assets
		*/
        void createFromV15(const GolaemCharacterV15& characterV15);

        // Accessors
        const GenericSpecificConverterMappingV7& getConverterMapping() const;
        void setConverterMapping(const GenericSpecificConverterMappingV7& mapping);
        const CharacterUserDataV0& getCharacterUserData() const;
        void setCharacterUserData(const CharacterUserDataV0& userData);

    private:
        GLM_DISALLOW_COPY_AND_ASSIGN(GolaemCharacterV16);
        static void addAttributes();
    };
} // namespace glm
