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

#pragma once

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

namespace glm
{
    struct ShaderAttributeV0;

    /**
	* \brief Shader Attribure
	*/
    struct GLM_CORE_API ShaderAttributeV1
    {
        GLM_RTTI("3f2d0f23-263f-4773-802e-22aaba7ce462", ShaderAttributeV1, addAttributes)
    public:
        GLM_CLASS_STAT_ID( glm::MemoryStatIds::GolaemShared);

        /// The name of the attribute
        glm::GlmString _name;

        /// The type of the attribute
        ShaderAttributeType::Value _type;

        /// The min value (to be interpreted according to the type)
        glm::GlmString _minValue;

        /// The max value (to be interpreted according to the type)
        glm::GlmString _maxValue;

        /// The string value
        glm::GlmString _stringValue;

        /// If true, a random value between the min and max values will be used,
        /// otherwise the PP attribute value will be used instead
        ShaderAttributeValueType::Value _valueType;

        /// The PP attribute from which to retrieve the value
        glm::GlmString _ppAttr;

        ShaderAttributeV1();

        /**
		* \brief V0 backwards compatibility
		* \note v0 has a file attr (instead of a string) and does not have a _useChannel bool
		*/
        void createFromV0(ShaderAttributeV0& shaderAttributeV0);

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

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

        /**
		* \brief Accessor to the attribute type needed for inspection
		*/
        int getValueTypeAsInt() const;
        void setValueTypeFromInt(int value);
    };
} // namespace glm
