#ifndef VULKAN_FENCE_HPP_
#define VULKAN_FENCE_HPP_

#include <memory>

#include <Utilities/Extern.hpp>
#include <Vk/Device/Device.hpp>

namespace Vk
{
    /**
     * @brief Represents a Vulkan fence.
     */
    class Fence
    {
    private:
        std::shared_ptr<Vk::Device> m_device;
        VkFence m_fence;
    
    public:
        /**
         * @brief Construct a fence on the specified device.
         * 
         * @param device The device on which to create the fence.
         * @param flags The creation flags.
         */
        Fence(std::shared_ptr<Vk::Device> device, VkFenceCreateFlags flags = 0);
        Fence(const Fence &) = delete;
        ~Fence();

        /**
         * @brief Return the wrapped fence.
         */
        VkFence inner();

        /**
         * @brief Wait for this fence.
         * 
         * @param timeout The timeout (infinite by default).
         */
        bool wait(uint64_t timeout = UINT64_MAX);

        /**
         * @brief Reset this fence.
         */
        void reset();
    };
}

#endif