#pragma once

#include "FontAtlasBuilder.h"
#include "ShaderTypes.h"

#include <filesystem>
#include <map>
#include <string>
#include <vector>

namespace RenderCadenceCompositor
{
struct SupportedShaderSummary
{
	std::string id;
	std::string name;
	std::string description;
	std::string category;
};

struct ShaderSupportResult
{
	bool supported = false;
	std::string reason;
};

ShaderSupportResult CheckStatelessSinglePassShaderSupport(const ShaderPackage& shaderPackage);
std::string ShaderPackageFingerprint(const ShaderPackage& shaderPackage);

class SupportedShaderCatalog
{
public:
	bool Load(const std::filesystem::path& shaderRoot, unsigned maxTemporalHistoryFrames, std::string& error);
	const std::vector<SupportedShaderSummary>& Shaders() const { return mShaders; }
	const std::map<std::string, std::vector<FontAtlasBuildOutput>>& FontAtlases() const { return mFontAtlasesByShaderId; }
	const ShaderPackage* FindPackage(const std::string& shaderId) const;

private:
	std::vector<SupportedShaderSummary> mShaders;
	std::map<std::string, ShaderPackage> mPackagesById;
	std::map<std::string, std::vector<FontAtlasBuildOutput>> mFontAtlasesByShaderId;
};
}
