#pragma once
#include <type_traits>
namespace refl_impl {
	template<typename T>
	struct MetaImpl;

	template<typename T>
	struct _Multy;

	template<typename T, typename M>
	struct _Static;

	template<typename T, typename M>
	struct _Meta;
}
namespace refl {
	// 定义一个模板结构体用于检测是否为 数组
	template<typename T>
	struct is_array : std::false_type {};

	template<typename T, size_t N>
	struct is_array<T[N]> : std::true_type {
		using type = T;
		consteval static size_t Size() {return N;}
	};
	// 部分特化用于匹配 std::array
	template<typename T, size_t N>
	struct is_array<std::array<T, N>> : std::true_type {
		using type = T;
		consteval static size_t Size() { return N; }
	};
	// 定义一个模板结构体用于检测是否为 std::pair
	template<typename T>
	struct is_pair : std::false_type {};

	template<typename T1, typename T2>
	struct is_pair<std::pair<T1, T2>> : std::true_type {};

	template<typename T>
	concept is_pair_v = is_pair<T>::value;

	// 定义一个模板结构体用于检测是否为 std::pair
	template<typename T>
	struct is_tuple : std::false_type {};

	template<typename... Types>
	struct is_tuple<std::tuple<Types...>> : std::true_type {};

	template<typename T>
	concept is_tuple_v = is_tuple<T>::value;

	template<typename T>
	concept is_string_v = requires(T t) {
		{ static_cast<std::string>(t) } -> std::convertible_to<std::string>;
	};

	template<typename T>
	concept is_container_v = !is_array<T>::value && !is_string_v<T> && requires(T a) {
		{ a.begin() } -> std::input_iterator;
		{ a.end() } -> std::input_iterator;
	};

	template<typename T>
	concept is_map_v = is_pair_v<typename T::value_type> && is_container_v<T>;

	template<typename T>
	concept is_sequence_v = !is_pair_v<typename T::value_type> && is_container_v<T>;
};
namespace refl {
	template<typename T>
	struct real_type {
		using type = std::remove_cv_t<T>;
	};
	template<typename T>
	struct real_type<T&> {
		using type = std::remove_cv_t<T>*;
	};
	template<typename T>
	struct real_type<T*> {
		using type = std::remove_cv_t<T>*;
	};

	template<typename T>
	using real_type_t = real_type<T>::type;

	//转化为指针类型
	template<typename T>
	struct args_type {
		using type = T;
	};
	template<typename T>
	struct args_type<T&> {
		using type = T;
	};
	template<typename T>
	struct args_type<T*> {
		using type = T;
	};
	template<typename T>
	using args_type_t = args_type<std::remove_cv_t<T>>::type;
};
namespace refl {
	using refl_impl::MetaImpl;

	template <class MyMeta>
	concept _ReflCheck_Parent = requires { typename MyMeta::MyParent;} && !std::is_same_v<typename MyMeta::MyParent, void>;

	template <class T>
	concept _ReflCheck_Ctor = requires { T(); };
	template <class T>
	concept _ReflCheck_UClass = requires { typename MetaImpl<T>::MyMeta; };

	//类型接口
	template<typename T>
	struct TypeInfoImpl;

	template<typename T>
	using TypeInfo = TypeInfoImpl<real_type_t<T>>;
}
namespace refl {
	constexpr static std::array<std::string_view, 16> IndexNames = {
		"1", "2", "3", "4", "5", "6", "7", "8",
		"9", "10", "11", "12", "13", "14", "15", "16"
	};
}