#pragma once

#include "File.h"
#include "TemplateFile.h"

#include <vector>
#include <string>

class TemplatingEngine
{
public:
	TemplatingEngine(const Path& workingDirectory);

	void loadTemplateFiles();

	std::string processTemplate(const std::string& name);

private:
	TemplateFile* getTemplateFile(const std::string& name);
	TemplateFile* getTemplateFile(const Path& path);
	std::string render(TemplateNode* content);

	std::string processTemplate(TemplateFile* file, TemplateNode* parent = nullptr);

	std::vector<std::unique_ptr<TemplateFile> > mTemplateFiles;
	Path mWorkingDirectory;
	std::string mTemplateExtension{ ".html" };
};