#pragma once

#include <string>

#include <vulkan/vulkan_core.h>

#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>

struct FWindowConfig
{
	std::string Title = "Learning Vulkan";
	uint32_t	Width = 800;
	uint32_t	Height = 600;
	bool		bResizable = false;
	bool		bFullscreen = false;
};

class GlfwWindowManager
{
public:
	GlfwWindowManager();
	~GlfwWindowManager();

	void Initialize(const FWindowConfig& Config);
	void Cleanup();

	bool ShouldClose() const;
	void PollEvents();
	void WaitEvents() const;
	void SetTitle(const std::string& Title);

	uint32_t		   GetWidth() const { return Config.Width; }
	uint32_t		   GetHeight() const { return Config.Height; }
	const std::string& GetTitle() const { return Config.Title; }

	bool IsInitialized() const { return Window; }

	void SetResizeCallback(GLFWwindowsizefun Callback);
	void SetKeyCallback(GLFWkeyfun Callback);
	void SetMouseButtonCallback(GLFWmousebuttonfun Callback);
	void SetCursorPositionCallback(GLFWcursorposfun Callback);
	void SetScrollCallback(GLFWscrollfun Callback);

	GLFWwindow* GetWindow() const { return Window; }

private:
	FWindowConfig Config;
	GLFWwindow*	  Window;

	void InitializeGlfw();

	void DestroyWindow();
};
