"""greeting_trigger.launch.py -- Launch proximity-based greeting trigger (Issue #270).

Usage:
  ros2 launch saltybot_social greeting_trigger.launch.py
  ros2 launch saltybot_social greeting_trigger.launch.py proximity_m:=1.5 cooldown_s:=120.0
"""

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


def generate_launch_description():
    pkg = get_package_share_directory("saltybot_social")
    cfg = os.path.join(pkg, "config", "greeting_trigger_params.yaml")

    return LaunchDescription([
        DeclareLaunchArgument("proximity_m",  default_value="2.0",
                              description="Greeting proximity threshold (m)"),
        DeclareLaunchArgument("cooldown_s",   default_value="300.0",
                              description="Per-face_id re-greeting cooldown (s)"),

        Node(
            package="saltybot_social",
            executable="greeting_trigger_node",
            name="greeting_trigger_node",
            output="screen",
            parameters=[
                cfg,
                {
                    "proximity_m": LaunchConfiguration("proximity_m"),
                    "cooldown_s":  LaunchConfiguration("cooldown_s"),
                },
            ],
        ),
    ])
