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

#pragma once

#include "InworldRuntimeTypes.h"
#include "Logging/LogMacros.h"

namespace inworld
{
class VADInterface;
}

#include "InworldVADTypes.generated.h"

INWORLDRUNTIME_API DECLARE_LOG_CATEGORY_EXTERN(LogInworldVAD, Log, All);

/**
 * @struct FInworldVADCreationConfig
 * @brief Configuration for creating VAD (Voice Activity Detection) instances.
 *
 * This structure defines the parameters required for setting up VAD processing components.
 * Currently serves as a placeholder for future VAD creation configuration options.
 */
USTRUCT(BlueprintType)
struct FInworldVADCreationConfig
{
	GENERATED_BODY()
};

/**
 * @struct FInworldVADConfig
 * @brief Configuration for VAD (Voice Activity Detection) runtime processing.
 *
 * This structure defines the runtime parameters for voice activity detection,
 * including sensitivity thresholds for speech detection accuracy.
 */
USTRUCT(BlueprintType)
struct FInworldVADConfig
{
	GENERATED_BODY()

	/** Sensitivity threshold for detecting speech. This is  a `float` value where higher thresholds make the detection more
	 * selective (fewer false positives), and lower thresholds make it more sensitive (detecting quieter speech). Valid range: 0.0
	 * - 1.0 (default = 0.4) */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, config, Category = "Inworld|Voice Activity",
		meta = (ClampMin = "0.0", ClampMax = "1.0",
			ToolTip =
				"Sensitivity threshold for detecting speech. Higher thresholds make the detection more selective (fewer false positives), and lower thresholds make it more sensitive (detecting quieter speech). Valid range: 0.0-1.0 (default = 0.4)"))
	float SpeechThreshold = 0.4f;
};

/** Native delegate called when VAD primitive creation completes with interface access */
DECLARE_DELEGATE_OneParam(FOnInworldVADPrimitiveCreatedNative, TSharedPtr<inworld::VADInterface> /*InworldVAD*/);

namespace inworld
{

class LocalVADConfig;
/**
 * @brief Converts Unreal VAD creation configuration to internal VAD configuration.
 * @param In The Unreal VAD creation configuration to convert
 * @param Out The internal VAD configuration to populate
 */
void Convert(const FInworldVADCreationConfig& In, inworld::LocalVADConfig& Out);

}	 // namespace inworld
