#pragma once
#include "render/asset_struct.h"
#include "resource_manager.h"
#include "yaml/yaml.h"
namespace engineapi {
	class Asset : public Resource<Asset> {
	private:
		static void __Init__();
		friend class FileManager;
	public:
		using Base = Resource<Asset>;
		const refl::UClass* meta;
		Asset(const refl::UClass* meta): Base(), meta(meta){}
		refl::Any Meta() {
			return refl::Any{ this, meta };
		}
	};
	template<>
	inline void MetaBundle::Add(RscHandle<Asset> h)
	{
		if (h)
		{
			metadatas.emplace_back(SerializedMeta{ h.guid, string(h->Name()), string(type_name<Asset>().View()), YAML::Text_Serialize(h->Meta())});
		}
	}
}
/*
namespace refl {
	struct Wrap_Asset {
		engineapi::RscHandle<engineapi::Asset> mHandle;
		UPROPERTY({})
		string mName;
		const refl::UClass* meta;
	};
	template<>
	struct real_type<engineapi::Asset> {
		using type = Wrap_Asset;
	};
}
#include "asset_gen.inl"
*/