// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.

#include "Nodes/ComboActionGraphNode_StartNode.h"

#define LOCTEXT_NAMESPACE "ComboActionGraphNode_StartNode"


UComboActionGraphNode_StartNode::UComboActionGraphNode_StartNode()
{
#if WITH_EDITORONLY_DATA
	this->bAllowInputNodes = false;
	this->NodeTitle = LOCTEXT("ComboActionGraphNode_StartNodeTitle", "Start Action");
	this->NodeTypeName = LOCTEXT("ComboActionGraphNode_StartNodeInternalTitle", "Start Action");
	this->ContextMenuName = LOCTEXT("ComboActionGraphNode_StartNodeContextMenuName", "Start Action");
	this->BackgroundColor = FLinearColor(0, 1, 0, 1);
	
	this->bAllowCopy = false;
	this->bAllowCut = false;
	this->bAllowPaste = false;
	this->bAllowDelete = false;
	this->bAllowManualCreate = false;

	this->NodeTooltipText = LOCTEXT("ComboActionGraphNode_CompleteTooltip", "* This Node will be added to the graph automatically.\n* This Node cannot be created manually.\n* This Node cannot be deleted.\n* Does not implement any logic.");
#endif

	this->MaxChildrenNodes = -1;
}

#if WITH_EDITOR

FText UComboActionGraphNode_StartNode::GetDescription_Implementation() const
{
	return LOCTEXT("ComboActionGraphNode_StartNodeDescription", "Start node is automatically placed and cannot be deleted.");
}

bool UComboActionGraphNode_StartNode::ValidateNode(TArray<FText>& ValidationsMessages, const bool RichFormat)
{
	bool bResult = Super::ValidateNode(ValidationsMessages, RichFormat);

	if (ChildrenNodes.Num() == 0)
	{
		bResult = false;

		const FString RichTextReturn =
			FString("* ")
			.Append("<RichTextBlock.Bold>")
			.Append(this->NodeTitle.ToString())
			.Append("</>")
			.Append(": Does not have any child nodes!");

		const FString TextReturn =
			FString(this->NodeTitle.ToString())
			.Append(": Does not have any child nodes!");
		
		ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
	}

	return bResult;
}

#endif

#undef LOCTEXT_NAMESPACE
