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

#pragma once

#include "CoreMinimal.h"
#include "EdGraph/EdGraph.h"

#include "EdComboActionGraph.generated.h"

DECLARE_LOG_CATEGORY_EXTERN(LogEdComboActionGraph, Log, All);


UCLASS()
class COMBOINPUTEDITOR_API UEdComboActionGraph : public UEdGraph
{
	GENERATED_BODY()

public:
	virtual void RebuildComboActionGraph();

	UComboActionGraph *GetComboActionGraph() const;

	virtual bool Modify(bool bAlwaysMarkDirty) override;
	virtual void PostEditUndo() override;

	TWeakPtr<class FAssetEditor_ComboActionGraph> GetComboActionEditorPtr() const { return this->ComboActionEditorPtr; }
	void SetDialogueEditorPtr(TWeakPtr<class FAssetEditor_ComboActionGraph> NewPtr);
	void ResetDialogueEditorPtr() { this->ComboActionEditorPtr.Reset(); }
	
	bool JumpToNode(const class UComboActionGraphNode *Node);

public:
	UPROPERTY(Transient)
		TMap<class UComboActionGraphNode*, class UEdComboActionGraphNode*> NodeMap;

	UPROPERTY(Transient)
		TMap<class UComboActionGraphEdge*, class UEdComboActionGraphEdge*> EdgeMap;

protected:
	void Clear();
	void SortNodes(UComboActionGraphNode *RootNode);

private:
	/** Pointer back to the combo action editor that owns us */
	TWeakPtr<FAssetEditor_ComboActionGraph> ComboActionEditorPtr;
};
