// Copyright (c) 2024 Codemongous LLC. All Rights Reserved.

#include "SCW_UK2Node_FunctionEntry.h"

#include "K2Node_FunctionEntry.h"
#include "SCW_UEdGraphNode.h"
#include "SourcifyCoreUEWrapperModule.h"

using namespace Sourcify;

SCW_UK2Node_FunctionEntry::SCW_UK2Node_FunctionEntry(UK2Node_FunctionEntry* InK2Node_FunctionEntry) : SCW_UK2Node_FunctionTerminator(InK2Node_FunctionEntry), K2Node_FunctionEntry(InK2Node_FunctionEntry)
{

}

ISCW_UEdGraphNodePtr SCW_UK2Node_FunctionEntry::AsUEdGraphNode() const
{
	return GetSharedThisAs<SCW_UEdGraphNode>();
}

ISCW_UK2Node_FunctionTerminatorPtr SCW_UK2Node_FunctionEntry::AsUK2Node_FunctionTerminator() const
{
	return GetSharedThisAs<SCW_UK2Node_FunctionTerminator>();
}

bool SCW_UK2Node_FunctionEntry::GetCanRenameNode() const
{
	return K2Node_FunctionEntry->GetCanRenameNode();
}

vector<ISCW_FBPVariableDescriptionPtr> SCW_UK2Node_FunctionEntry::GetLocalVariables() const
{
	vector<ISCW_FBPVariableDescriptionPtr> LocalVariables;
	for (auto& LocalVariable : K2Node_FunctionEntry->LocalVariables)
	{
		LocalVariables.push_back(FSourcifyCoreUEWrapper::Get().Wrap(LocalVariable));
	}

	return LocalVariables;
}

void SCW_UK2Node_FunctionEntry::SetExtraFlags(int32_t InFlags)
{
	K2Node_FunctionEntry->SetExtraFlags(static_cast<int32>(InFlags));
}

UK2Node_FunctionEntry* SCW_UK2Node_FunctionEntry::ToUK2Node_FunctionEntry() const
{
	return K2Node_FunctionEntry;
}
