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

#pragma once
#include "CoreMinimal.h"
#include "ISCW_UStateTree.h"
#if ISCW_UE_VERSION_NEWER_THAN_OR_EQUAL(5,6,0)
#include "SCW_UDataAsset.h"

class UStateTree;
struct FStateTreeEditorNode;

namespace Sourcify
{
	class SCW_UStateTree : public SCW_UDataAsset, public virtual ISCW_UStateTree
	{
	public:
		SCW_UStateTree(UStateTree* InStateTree);

		UStateTree* ToUStateTreeRawPtr() const;
		ISCW_UStateTreePtr ToUStateTreePtr() override;
		ISCW_UStateTreeConstPtr ToUStateTreePtr() const override;

		void Compile() override;
		void VisitPropertyBags(function<void(ISCW_FInstancedPropertyBag&)> Visitor) override;
		void VisitEditorNodeStructTypes(function<void(ISCW_UScriptStructConstPtr currentType, function<void(ISCW_UScriptStructPtr newType)> replacer)> Visitor) override;
		void VisitEventPayloadStructs(function<void(ISCW_UScriptStructConstPtr currentType, function<void(ISCW_UScriptStructPtr newType)> replacer)> Visitor) override;
		void VisitSchemaTypeReferences(function<void(ISCW_UObjectConstPtr currentType, function<void(ISCW_UObjectPtr newType)> replacer)> Visitor) override;
		void VisitPropertyBindingPathSegments(function<wstring(const wstring& segmentName)> Visitor) override;

	private:
		void VisitEditorNodes(TArray<FStateTreeEditorNode>& Nodes, function<void(ISCW_UScriptStructConstPtr, function<void(ISCW_UScriptStructPtr)>)>& Visitor);
		void VisitSingleEditorNode(FStateTreeEditorNode& Node, function<void(ISCW_UScriptStructConstPtr, function<void(ISCW_UScriptStructPtr)>)>& Visitor);

	protected:
		UStateTree* StateTree;
	};
} // namespace Sourcify
#endif // ISCW_UE_VERSION_NEWER_THAN_OR_EQUAL(5,6,0)