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

#pragma once

#include "CoreMinimal.h"
#include "Graph/InworldData.h"
#include "InworldRuntimeTypes.h"
#include "Misc/Paths.h"
#include "Misc/TVariant.h"
#include "Primitives/VAD/InworldVADTypes.h"
#include "Tasks/Task.h"

namespace inworld
{
class VADInterface;
}	 // namespace inworld

namespace inworld
{
namespace Tasks
{
namespace VAD
{

/**
 * @brief Creates an asynchronous task for initializing a VAD (Voice Activity Detection) interface.
 *
 * This function creates a task that initializes the VAD system with the provided configuration.
 * The task returns either a valid VAD interface or an error message string.
 *
 * @param VADConfig Configuration parameters for VAD creation
 * @return Task that resolves to either a shared pointer to VADInterface or an error string
 */
UE::Tasks::TTask<TVariant<TSharedPtr<inworld::VADInterface>, FString>> CreateVADTask(const FInworldVADCreationConfig& VADConfig);

/**
 * @brief Creates an asynchronous task for detecting voice activity in audio data.
 *
 * This function creates a task that processes audio data through the VAD system to detect
 * whether speech is present. The task returns a boolean indicating voice activity detection
 * or an error message if processing fails.
 *
 * @param VADInterface The VAD interface to use for voice activity detection
 * @param Config Runtime configuration settings for VAD processing
 * @param Audio The audio data to analyze for voice activity
 * @return Task that resolves to either a boolean (true if voice activity detected) or an error string
 */
UE::Tasks::TTask<TVariant<bool, FString>> CreateDetectVoiceActivityTask(
	TSharedPtr<inworld::VADInterface> VADInterface, const FInworldVADConfig& Config, const FInworldData_Audio& Audio);

}	 // namespace VAD
}	 // namespace Tasks
}	 // namespace inworld
