#pragma once

#include "CoreMinimal.h"
#include "WingServer.h"
#include "WingHandler.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 Node;

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

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