#pragma once
#include "Graphics.h"
#include <DirectXMath.h>
#include <memory>
#include <vector>
#include "Bindable.h"
#include "IndexBuffer.h"
#include "Logger.h"

class Bindable;

class Drawable
{
	template<class T>
	friend class DrawableBase; // Enable DrawableBase to access member of Drawable
public:
	Drawable() = default;
	Drawable(const Drawable&) = delete;
	virtual DirectX::XMMATRIX GetTransformXM(Graphics& gfx) const noexcept = 0;
	void Draw(Graphics& gfx, Logger& logger) const noexcept;

	virtual void Update(float dt) noexcept = 0;
	void AddBind(std::unique_ptr<Bindable> bind) noexcept;
	void AddIndexBuffer(std::unique_ptr<class IndexBuffer> ibuf) noexcept;
	void ExecuteBind(Graphics& gfx, Logger& logger) noexcept;
	virtual ~Drawable() = default;
private:
	const IndexBuffer* pIndexBuffer = nullptr;
	std::vector<std::unique_ptr<Bindable>> binds;
	virtual const std::vector<std::unique_ptr<Bindable>>& GetStaticBinds() const noexcept = 0;
};