#pragma once

#include "CoreMinimal.h"
#include "UObject/SoftObjectPtr.h"
#include "WingBasics.h"

class UClass;
class UWidget;
struct FAssetData;


class WingWidgets
{
public:
	struct Type
	{
		FString MenuName;
		TSoftClassPtr<UWidget> Class;
	};

	TArray<Type> AllWidgets;

	WingWidgets();

	// Search for widget types whose name matches the query.
	TArray<Type> Search(const FString& Query, int32 MaxResults, bool Exact);

	// Check if a widget can accept children. Prints error if not.
	static bool CheckCanBeParent(UWidget* Widget, WingOut Errors);

	// Print out a tree of widgets, just showing the names and types.
	static void PrintWidgetTree(UWidget* Widget, int32 Depth);

private:
	static FString WidgetMenuString(UClass* WidgetClass);
	static FString WidgetMenuString(const FAssetData &Data);
};
