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

#pragma once

#include "K2Node.h"
#include "K2Node_EventNodeInterface.h"
#include "EdGraph/EdGraphNodeUtils.h"

#include "K2Node_ComboAction.generated.h"


class UInputAction;
enum class ETriggerEvent : uint8;
namespace ENodeTitleType { enum Type : int; }
struct FBlueprintNodeSignature;

class FBlueprintActionDatabaseRegistrar;
class FKismetCompilerContext;


UCLASS()
class COMBOINPUTNODES_API UK2Node_ComboAction : public UK2Node, public IK2Node_EventNodeInterface
{
	GENERATED_BODY()

public:
	UK2Node_ComboAction(const FObjectInitializer &ObjectInitializer) : Super(ObjectInitializer){}

	UPROPERTY()	TObjectPtr<const class UComboAction> ComboAction;

	//~ Begin UEdGraphNode Interface.
	virtual void AllocateDefaultPins() override;
	virtual FLinearColor GetNodeTitleColor() const override;
	virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
	virtual FText GetTooltipText() const override;
	virtual FSlateIcon GetIconAndTint(FLinearColor &OutColor) const override;
	virtual bool IsCompatibleWithGraph(UEdGraph const *Graph) const override;
	virtual UObject* GetJumpTargetForDoubleClick() const override;
	virtual void JumpToDefinition() const override;
	//~ End UEdGraphNode Interface.

	//~ Begin UK2Node Interface
	virtual void ValidateNodeDuringCompilation(class FCompilerResultsLog &MessageLog) const override;
	virtual bool ShouldShowNodeProperties() const override { return true; }
	virtual void ExpandNode(FKismetCompilerContext &CompilerContext, UEdGraph *SourceGraph) override;
	virtual void GetMenuActions(FBlueprintActionDatabaseRegistrar &ActionRegistrar) const override;
	virtual FText GetMenuCategory() const override;
	virtual bool CanUserEditPinAdvancedViewFlag() const override { return true; }
	virtual FBlueprintNodeSignature GetSignature() const override;
	//~ End UK2Node Interface

	//~ Begin IK2Node_EventNodeInterface Interface.
	virtual TSharedPtr<FEdGraphSchemaAction> GetEventNodeAction(const FText &ActionCategory) override;
	//~ End IK2Node_EventNodeInterface Interface.

private:
	FName GetActionName() const;
	
	/** Constructing FText strings can be costly, so we cache the node's title/tooltip */
	FNodeTextCache CachedTooltip;
	FNodeTextCache CachedNodeTitle;
};
