#ifndef EMULATOR_SRC_GRAPHICS_PRESENTATION_WINDOW_WINDOWINTERNAL_H_
#define EMULATOR_SRC_GRAPHICS_PRESENTATION_WINDOW_WINDOWINTERNAL_H_

#include "SDL_video.h"
#include "common/threads.h"
#include "graphics/host_gpu/graphicContext.h"
#include "graphics/host_gpu/vulkanCommon.h"

#include <cstdint>
#include <vector>

namespace Libs::Graphics {

struct SurfaceCapabilities {
	vk::SurfaceCapabilitiesKHR        capabilities {};
	std::vector<vk::SurfaceFormatKHR> formats;
	std::vector<vk::PresentModeKHR>   present_modes;
	bool                              format_srgb_bgra32  = false;
	bool                              format_unorm_bgra32 = false;
};

struct WindowContext {
	GraphicContext       graphic_ctx;
	VulkanSwapchain*     swapchain            = nullptr;
	SDL_Window*          window               = nullptr;
	bool                 window_hidden        = true;
	vk::SurfaceKHR       surface              = nullptr;
	SurfaceCapabilities* surface_capabilities = nullptr;

	char device_name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE] = {0};
	char processor_name[64]                            = {0};

	Common::Mutex mutex;
};

extern WindowContext* g_window_ctx;

void VulkanGetSurfaceCapabilities(vk::PhysicalDevice physical_device, vk::SurfaceKHR surface,
                                  SurfaceCapabilities& capabilities);
VulkanSwapchain* VulkanCreateSwapchain(uint32_t image_count);
void             VulkanCreate(WindowContext& window);

void WindowUpdateIcon();
void WindowUpdateTitle();

} // namespace Libs::Graphics

#endif // EMULATOR_SRC_GRAPHICS_PRESENTATION_WINDOW_WINDOWINTERNAL_H_
