#ifndef CSHADERSMANAGER_HPP
#define CSHADERSMANAGER_HPP

#include <string>
#include <cstdlib>
#include <map>

#include <nlohmann/json.hpp>

#include "../../Model/Graphic/Shader/CShader.hpp"
#include "../../Context/CContext.hpp"

#include "../Exception/CJsonException.hpp"
#include "../Exception/CFileException.hpp"
#include "../Exception/CRuntimeException.hpp"

/*#ifdef WIN32
	#define SHADERS_FOLDER "../assets/shaders"
#else 
	#define SHADERS_FOLDER "../../assets/shaders"
#endif*/

/**
 * @brief Class to manage shaders.
 */
class CShadersManager {
private:
	/**
	 * @brief map to store in a proper way the shaders.
	 */
	std::map<std::string, CShader*> m_shadersMap;

	CShader** m_shaderList;
public:
	/**
	 * @brief constructor.
	 */
	CShadersManager(void);

	CShadersManager(const CShadersManager& param) = delete;

	/**
	 * @brief destructor, destroy the shaders of the list.
	 */
	~CShadersManager(void);

	CShadersManager& operator=(const CShadersManager& param) = delete;

	/**
	 * @brief get a shader by its name.
	 * @param[in] name shader name.
	 * @return the shader.
	 */
	CShader* get(std::string name) const;

	/**
	 * @brief compile and link all the shaders to make them ready to use.
	 */
	void compile(void);

	/**
	 * @brief search the folder assets/shaders and create the shaders specifieds by a json file.
	 * @post throw an FileException if the shaders folder is not found.
	 */
	void create(void);
};

#endif