#pragma once

/**
 * \file Display.h
 * \brief File containing the blitz::Display class
 */

#include <memory>
#include <string>

class SDL_Window;

namespace blitz {

class Client;

namespace gui {
class BlitzGui;
}  // namespace gui

/**
 * \class Display
 * \brief Class used to manage the display
 */
class Display {
  private:
	SDL_Window* m_Window;
	void* m_GL_Context;

	int m_WindowWidth;
	int m_WindowHeight;
	float m_AspectRatio;
	std::string m_WindowName;

	bool m_ShouldClose;
	bool m_FullScreen;

	Client* m_Client;
	std::unique_ptr<gui::BlitzGui> m_BlitzGui;

  public:
	/**
	 * \brief Constructor
	 * \param width The width of the window
	 * \param height The height of the window
	 * \param windowName The name of the window
	 * \param client The client
	 */
	Display(int width, int height, const std::string& windowName, Client* client);
	~Display();

	/**
	 * \brief Return whether the display has been created
	 */
	bool Create();
	/**
	 * \brief Poll the events
	 * \note This function should be called at the beginning of the main loop
	 */
	void PollEvents();
	/**
	 * \brief Update the display
	 * \note Swap the buffers
	 */
	void Update();
	/**
	 * \brief Render the display (ImGui)
	 */
	void Render();
	/**
	 * \brief Destroy the display (Not your mother's display)
	 */
	void Destroy();

	/**
	 * \brief Return whether the display should be closed
	 */
	bool IsCloseRequested();

	/**
	 * \brief Return widht/height ratio
	 */
	float GetAspectRatio();
	/**
	 * \brief Return the window width
	 */
	int GetWindowWidth();
	/**
	 * \brief Return the window height
	 */
	int GetWindowHeight();

  private:
	void InitImGui();
};

}  // namespace blitz
