#!/usr/bin/env python3
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration

def generate_launch_description():
    interface_arg = DeclareLaunchArgument('interface', default_value='wlan0', description='WiFi interface')
    roam_threshold_arg = DeclareLaunchArgument('roam_threshold_dbm', default_value='-70', description='Roaming threshold (dBm)')
    target_ssid_arg = DeclareLaunchArgument('target_ssid', default_value='SaltyLab', description='Target SSID')
    fallback_tether_arg = DeclareLaunchArgument('fallback_tether', default_value='true', description='Enable USB tethering fallback')

    wifi_monitor_node = Node(
        package='saltybot_wifi_monitor',
        executable='wifi_monitor',
        name='wifi_monitor_node',
        parameters=[{'interface': LaunchConfiguration('interface'), 'roam_threshold_dbm': LaunchConfiguration('roam_threshold_dbm'), 'target_ssid': LaunchConfiguration('target_ssid'), 'fallback_tether': LaunchConfiguration('fallback_tether')}],
        output='screen',
    )
    return LaunchDescription([interface_arg, roam_threshold_arg, target_ssid_arg, fallback_tether_arg, wifi_monitor_node])
