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


def generate_launch_description():
    return LaunchDescription([
        DeclareLaunchArgument("wifi6_vehicle_host", default_value="127.0.0.1"),
        DeclareLaunchArgument("wifi6_vehicle_port", default_value="9000"),
        DeclareLaunchArgument("wifi6_timeout_ms", default_value="5000"),
        DeclareLaunchArgument("wifi6_precheck_enabled", default_value="true"),
        DeclareLaunchArgument("wifi6_precheck_require_all_links", default_value="true"),
        Node(
            package="workshop_orchestrator_v2",
            executable="workshop_orchestrator_v2_node",
            name="workshop_orchestrator_v2",
            output="screen",
            parameters=[{
                "wifi6_vehicle_host": LaunchConfiguration("wifi6_vehicle_host"),
                "wifi6_vehicle_port": ParameterValue(LaunchConfiguration("wifi6_vehicle_port"), value_type=int),
                "wifi6_timeout_ms": ParameterValue(LaunchConfiguration("wifi6_timeout_ms"), value_type=int),
                "wifi6_precheck_enabled": ParameterValue(
                    LaunchConfiguration("wifi6_precheck_enabled"), value_type=bool),
                "wifi6_precheck_require_all_links": ParameterValue(
                    LaunchConfiguration("wifi6_precheck_require_all_links"), value_type=bool),
            }],
        )
    ])
