/**
 * Copyright 2022-2025 Theai, Inc. dba Inworld AI
 */
#include "GraphEditor/AssetActions_InworldGraph.h"
#include "InworldRuntimeEditor.h"
#include "GraphEditor/InworldGraphAssetEditor/AssetEditor_InworldGraph.h"

#define LOCTEXT_NAMESPACE "AssetActions_InworldGraph"

FAssetActions_InworldGraph::FAssetActions_InworldGraph(EAssetTypeCategories::Type InAssetCategory)
	: MyAssetCategory(InAssetCategory)
{
}

FText FAssetActions_InworldGraph::GetName() const
{
	return LOCTEXT("FInworldGraphAssetTypeActionsName", "Inworld Graph");
}

FColor FAssetActions_InworldGraph::GetTypeColor() const
{
	return FColor::White;
}

UClass* FAssetActions_InworldGraph::GetSupportedClass() const
{
	return UInworldGraphAsset::StaticClass();
}

void FAssetActions_InworldGraph::OpenAssetEditor(const TArray<UObject*>& InObjects, TSharedPtr<class IToolkitHost> EditWithinLevelEditor)
{
	const EToolkitMode::Type Mode = EditWithinLevelEditor.IsValid() ? EToolkitMode::WorldCentric : EToolkitMode::Standalone;

	for (auto ObjIt = InObjects.CreateConstIterator(); ObjIt; ++ObjIt)
	{
		if (UInworldGraphAsset* Graph = Cast<UInworldGraphAsset>(*ObjIt))
		{
			TSharedRef<FAssetEditor_InworldGraph> NewGraphEditor(new FAssetEditor_InworldGraph());
			NewGraphEditor->InitGraphAssetEditor(Mode, EditWithinLevelEditor, Graph);
		}
	}
}

uint32 FAssetActions_InworldGraph::GetCategories()
{
	return MyAssetCategory;
}

//////////////////////////////////////////////////////////////////////////

#undef LOCTEXT_NAMESPACE
