"""Launch file for face display bridge node."""

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


def generate_launch_description():
    """Generate launch description."""
    # Declare arguments
    url_arg = DeclareLaunchArgument(
        "face_server_url",
        default_value="http://localhost:3000/face/{id}",
        description="Face display server HTTP endpoint"
    )
    timeout_arg = DeclareLaunchArgument(
        "http_timeout",
        default_value="2.0",
        description="HTTP request timeout in seconds"
    )

    # Create node
    face_bridge_node = Node(
        package="saltybot_face_bridge",
        executable="face_bridge_node",
        name="face_bridge",
        parameters=[
            {"face_server_url": LaunchConfiguration("face_server_url")},
            {"http_timeout": LaunchConfiguration("http_timeout")},
            {"update_interval": 0.1},
        ],
        output="screen",
    )

    return LaunchDescription([
        url_arg,
        timeout_arg,
        face_bridge_node,
    ])
