#pragma once

#include "forward.hpp"
#include <vector>
#include <optional>

namespace render::vk {

class SwapChain final {
public:
    SwapChain(VkDevice, const PhysicalDeviceInfo &);
    ~SwapChain();

    const std::vector<VkImageView> &getImageViews() { return imageViews; }

    std::optional<uint32_t> acquireNextImage(VkSemaphore, VkFence);
    bool presentImage(uint32_t, VkSemaphore);

private:
    VkDevice device;

    VkQueue presentQueue;
    VkSwapchainKHR chain = VK_NULL_HANDLE;
    std::vector<VkImage> images;
    std::vector<VkImageView> imageViews;
    std::vector<VkFence> imagesInFlight;
};

}