"""Trick routines launch file (Issue #431).

Starts the trick_routines_node with configurable parameters.

Usage:
  ros2 launch saltybot_tricks tricks.launch.py
  ros2 launch saltybot_tricks tricks.launch.py \
    enable_voice_commands:=true cooldown_s:=8.0
"""

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node


def generate_launch_description():
    return LaunchDescription([
        # ── Launch arguments ─────────────────────────────────────────────────
        DeclareLaunchArgument(
            'obstacle_distance_m',
            default_value='0.5',
            description='Minimum safe distance to obstacles (meters)'
        ),
        DeclareLaunchArgument(
            'cooldown_s',
            default_value='10.0',
            description='Cooldown between tricks (seconds)'
        ),
        DeclareLaunchArgument(
            'enable_voice_commands',
            default_value='true',
            description='Enable voice command integration'
        ),

        # ── Trick routines node ──────────────────────────────────────────────
        Node(
            package='saltybot_tricks',
            executable='trick_routines_node',
            name='trick_routines_node',
            output='screen',
            parameters=[{
                'obstacle_distance_m':
                    LaunchConfiguration('obstacle_distance_m'),
                'cooldown_s':
                    LaunchConfiguration('cooldown_s'),
                'enable_voice_commands':
                    LaunchConfiguration('enable_voice_commands'),
            }],
            remappings=[
                ('/cmd_vel', '/cmd_vel'),
                ('/scan', '/scan'),
                ('/saltybot/voice_command', '/saltybot/voice_command'),
            ],
        ),
    ])
