#pragma once
#include "../vulkan.h"
#include "vk_mem_alloc.h"
namespace vulkanapi {
    class Device;
    class Image {
	public:
		struct Args {
			VkImageType Type;
			uint32_t Width;
			uint32_t Height;
			uint32_t Depth;
			uint32_t Layers;
			uint32_t Levels;
			VkFormat Format;
			VkImageUsageFlags Usage;
			VkImageTiling Tiling;
			VkSharingMode Sharing;
			VkSampleCountFlagBits Samples;
			int Layout;
			VmaMemoryUsage Memory;
		};
    protected:
		string mName;
		VkImage mPtr;
		Args mArgs;
		VmaAllocation mAllocation{nullptr};
        Device& mDevice;
    public:
		Image(Device& device, string name, const Args& args);
		Image(Device& device, string name, VkImage ptr, const Args& args);

		VkFormat Format() {
			return mArgs.Format;
		};
		VkImage& Ptr() {
			return mPtr;
		}
		VkImageView View(VkImageAspectFlags aspectFlags, VkImageViewType viewType) {
			return View(mArgs.Format, aspectFlags, viewType);
		};
		VkImageView View(VkFormat format, VkImageAspectFlags aspectFlags, VkImageViewType viewType);
		
	public:
		static Args Make2DArgs(uint32_t width, uint32_t height, VkFormat format, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VmaMemoryUsage memory);
	};
}