#pragma once

#include "CoreMinimal.h"
#include "WingServer.h"
#include "WingBasics.h"
#include "WingFetcher.h"
#include "WingUtils.h"
#include "EdGraph/EdGraphNode.h"
#include "GraphNode_GetComment.generated.h"


// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------

UCLASS()
class UWing_GraphNode_GetComment : public UWingHandler
{
	GENERATED_BODY()

public:
	UPROPERTY(EditAnywhere, meta=(Description="Target node"))
	FString NodePath;

	virtual void Register() override
	{
		UWingServer::AddHandler(this,
			TEXT("Get the comment text and bubble visibility of a node."));
	}
	virtual void Handle() override
	{
		WingFetcher F(WingOut::Stdout);
		UEdGraphNode* FoundNode = F.Walk(NodePath).Cast<UEdGraphNode>();
		if (!FoundNode) return;

		WingOut::Stdout.Printf(TEXT("Node: %s\n"), *WingUtils::FormatName(FoundNode));
		WingOut::Stdout.Printf(TEXT("Comment: %s\n"), *FoundNode->NodeComment);
		WingOut::Stdout.Printf(TEXT("BubbleVisible: %s\n"), FoundNode->bCommentBubbleVisible ? TEXT("true") : TEXT("false"));
	}
};
