#pragma once

#include <cstdint>
#include <string>
#include <vector>

#ifdef VKCHECK_IMGUI_BACKEND_GLFW
#define GLFW_INCLUDE_NONE
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
using BackendWindow = GLFWwindow;
#endif

#ifdef VKCHECK_IMGUI_BACKEND_SDL3
#include <SDL3/SDL_video.h>
using BackendWindow = SDL_Window;
#endif

bool backend_init();

float backend_get_main_scale();

bool backend_supports_vulkan();

bool backend_create_window(int32_t width, int32_t height, const std::string& title, BackendWindow** window);

std::vector<const char*> backend_get_instance_extensions();

bool backend_create_window_surface(struct VulkanContext& context, BackendWindow* window, struct VkSurfaceKHR_T** surface);

void backend_get_framebuffer_size(BackendWindow* window, int32_t* width, int32_t* height);

void backend_show_window(BackendWindow* window);

bool backend_init_for_vulkan(BackendWindow* window, bool install_callbacks);

/**
 * Polls events if applicable and returns a bool that, if true, means the window should close
 */
bool backend_poll_events(BackendWindow* window);

bool backend_window_is_minimized(BackendWindow* window);

void backend_sleep(int32_t milliseconds);

void backend_new_frame();

void backend_shutdown();

void backend_destroy_window(BackendWindow* window);

void backend_terminate();
