#ifndef VULKAN_SAMPLER_HPP_
#define VULKAN_SAMPLER_HPP_

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

namespace Vk
{
    /**
     * @brief Represents a Vulkan sampler.
     */
    class Sampler
    {
    private:
        std::shared_ptr<Vk::Device> m_device;
        VkSampler m_sampler;

        static std::unique_ptr<Vk::Sampler> m_pixelated;
        static std::unique_ptr<Vk::Sampler> m_cubemap;
        static std::unique_ptr<Vk::Sampler> m_bilinear;
    
    public:
        /**
         * @brief The sampler builder.
         */
        class Builder
        {
        private:
            VkSamplerCreateInfo m_createInfo;
        
        public:
            /**
             * @brief Default constructor, sets reasonable default properties.
             */
            Builder();

            /**
             * @brief Set up the sampler as a cubemap sampler.
             */
            Builder& cubemap();

            /**
             * @brief Set up the sampler as a bilinear sampler.
             */
            Builder& bilinear();

            /**
             * @brief Create the sampler on the specified device.
             */
            std::unique_ptr<Vk::Sampler> build(std::shared_ptr<Vk::Device> device);
        };

        Sampler() = default;
        Sampler(const Sampler &) = delete;
        ~Sampler();

        /**
         * @brief Return the wrapped sampler.
         */
        VkSampler inner();

        /**
         * @brief Create all the samplers.
         * 
         * @param device The device on which to create.
         */
        static void createAll(std::shared_ptr<Vk::Device> device);

        /**
         * @brief Returns a reference to the pixelated sampler.
         */
        static Vk::Sampler& pixelated();

        /**
         * @brief Returns a reference to the cubemap sampler.
         */
        static Vk::Sampler& cubemap();

        /**
         * @brief Returns a reference to the bilinear sampler.
         */
        static Vk::Sampler& bilinear();

        friend class Builder;
    };
}

#endif