#ifndef VULKAN_RENDER_PASS_HPP_
#define VULKAN_RENDER_PASS_HPP_

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

namespace Vk
{
    /**
     * @brief Represents a Vulkan render pass.
     */
    class RenderPass
    {
    private:
        std::shared_ptr<Vk::Device> m_device;
        VkRenderPass m_renderPass;
    
    public:
        /**
         * @brief Represents a render pass builder.
         */
        class Builder
        {
        private:
            std::vector<VkAttachmentDescription> m_attachmentDescriptions;
            std::vector<VkAttachmentReference> m_colorAttachmentRefs;
            VkSubpassDescription m_subpass;
            VkAttachmentReference m_depthAttachmentRef;
            VkSubpassDependency m_dependency;

        public:
            /**
             * @brief Construct the builder.
             */
            Builder();

            /**
             * @brief Add a color attachment,
             */
            Builder& addColorAttachment(
                VkFormat format,
                VkAttachmentLoadOp loadOp,
                VkAttachmentStoreOp storeOp,
                VkImageLayout initialLayout,
                VkImageLayout finalLayout
            );

            /**
             * @brief Add a depth attachment.
             */
            Builder& addDepthAttachment(
                VkFormat format,
                VkAttachmentLoadOp loadOp,
                VkAttachmentStoreOp storeOp,
                VkImageLayout initialLayout,
                VkImageLayout finalLayout
            );

            /**
             * @brief Build the render pass.
             */
            std::shared_ptr<Vk::RenderPass> build(std::shared_ptr<Vk::Device> device);
        };

        RenderPass(std::shared_ptr<Vk::Device> device, VkRenderPass renderPass);
        RenderPass(const RenderPass &) = delete;
        ~RenderPass();

        /**
         * @brief Return the wrapped render pass.
         */
        VkRenderPass inner();
    };
}

#endif