#pragma once

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

class UBlueprintNodeSpawner;
struct FEdGraphSchemaAction;


struct FWingGraphAction
{
    TSharedPtr<FEdGraphSchemaAction> Action;
    UBlueprintNodeSpawner *Spawner = nullptr;
    UEdGraph *Graph;
    FString Name;
    FString Keywords;

    FWingGraphAction(TSharedPtr<FEdGraphSchemaAction> &iAction, UEdGraph *iGraph);
    FWingGraphAction(UBlueprintNodeSpawner *iSpawner, UEdGraph *iGraph);

    UEdGraphNode *Execute(const FVector2D &Location) const;
};


struct FWingGraphActions
{
public:
    // Constructor populates the list of actions.
    FWingGraphActions(UEdGraph* iGraph);
    
    // Choose a subset of the actions.
    TArray<FWingGraphAction*> Search(const FString& Query, int32 MaxResults = 0, bool Exact=false);


private:
    // The Graph that we're generating Actions for.
    UEdGraph *Graph;

    // The Array of Actions
    TArray<FWingGraphAction> Actions;

    // Routines that collect actions and spawners.
    void CollectActions();
    void CollectSpawners();
};
