#pragma once
#include "field.h"
namespace refl {
	template<typename T, typename R, typename ...Args>
	consteval auto fetch_method_t(R(T::*)(Args...)) {
		using MethodType = R(*)(const void*, Args...);
		return MethodType{ nullptr };
	}
	template<typename R, typename ...Args>
	consteval auto fetch_method_t(R(*)(Args...)) {
		using MethodType = R(*)(Args...);
		return MethodType{ nullptr };
	}
	template<typename T>
	consteval int fetch_meta_size() {
		auto fields = T::__MakeStaticFields();
		int size = 0;
		for (auto& field : fields) {
			size += field.data.member.offset;
		}
		if (size == 0) {
			size = 1;
		}
		return size;
	}
	enum MetaFlag :uint32_t {
		META_NONE_FLAG = 0,
		META_SERIZLE_FLAG = 1 << 0,
		META_UI_FLAG = 1 << 0,
	};
	class UClass;
	class Meta {
	public:
		UClass* cls;
		uint32_t flag{ 0 };

		template<typename T, typename Obj>
		static FieldPtr MemberField(T Obj::* ptr, const Name& name, char*& memory, const MemberData& data = {});

		template<typename R, typename ...Args>
		static FieldPtr MethodField(R(*ptr)(Args...), const Name& name,char*& memory, const MethodData& data = {});

		template<typename T,typename R, typename ...Args>
		static FieldPtr MethodField(R(T::*ptr)(Args...), const Name& name,char*& memory, const MethodData& data = {});
	};
}