"""voice_command.launch.py — Launch file for voice command system (Issue #409)."""

from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
import os
from ament_index_python.packages import get_package_share_directory


def generate_launch_description():
    """Generate launch description for voice command system."""

    # Declare launch arguments
    config_arg = DeclareLaunchArgument(
        "config_file",
        default_value=os.path.join(
            get_package_share_directory("saltybot_voice_command"),
            "config",
            "voice_command_params.yaml",
        ),
        description="Path to voice command parameters YAML file",
    )

    # Voice command parser node
    voice_command_node = Node(
        package="saltybot_voice_command",
        executable="voice_command_node",
        name="voice_command_node",
        parameters=[LaunchConfiguration("config_file")],
        remappings=[],
        output="screen",
    )

    # Voice command router node
    voice_command_router = Node(
        package="saltybot_voice_command",
        executable="voice_command_router",
        name="voice_command_router",
        parameters=[LaunchConfiguration("config_file")],
        remappings=[],
        output="screen",
    )

    return LaunchDescription(
        [
            config_arg,
            voice_command_node,
            voice_command_router,
        ]
    )
