/**
 * Copyright 2022-2025 Theai, Inc. dba Inworld AI
 */

#pragma once

#include "CoreMinimal.h"
#include "Graph/Nodes/InworldNode_Custom.h"

#include "InworldNode_Routing.generated.h"

/**
 * @class UInworldNode_Routing
 * @brief A node that outputs the given input. Useful for routing data.
 *
 * @input FInworldData
 * @output FInworldData
 */
UCLASS()
class INWORLDRUNTIME_API UInworldNode_Routing : public UInworldNode_Custom
{
	GENERATED_BODY()

public:
	/**
	 * @brief Default constructor for the routing node.
	 */
	UInworldNode_Routing();

protected:
	/**
	 * @brief Processes input data by passing it through unchanged.
	 *
	 * This function implements the core routing functionality by simply returning
	 * the input data as output. This is useful for directing data flow in graphs
	 * without modification, allowing for cleaner graph layouts and data routing.
	 *
	 * @param Input The input data to route through the node
	 * @return The same data handle passed as input
	 */
	UFUNCTION()
	virtual UPARAM(meta = (DisplayName = "Output")) FInworldDataHandle Process_Default(const FInworldDataHandle& Input) const;

private:
	/**
	 * @brief Retrieves JSON configuration for the routing node.
	 *
	 * This override implementation generates the JSON configuration needed
	 * for the routing node's pass-through operations.
	 *
	 * @param GraphJson The JSON object to populate with configuration data
	 * @return Error code indicating success or failure of configuration generation
	 */
	virtual EInworldRuntimeErrors GetJsonConfig(const TSharedRef<FJsonObject>& GraphJson) override;
};
