"""sysmon.launch.py — Launch system resource monitor (Issue #355).

Usage:
  ros2 launch saltybot_social sysmon.launch.py
  ros2 launch saltybot_social sysmon.launch.py publish_rate:=2.0
  ros2 launch saltybot_social sysmon.launch.py disk_path:=/data
"""

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", "sysmon_params.yaml")

    return LaunchDescription([
        DeclareLaunchArgument("publish_rate", default_value="1.0",
                              description="Resource publish frequency (Hz)"),
        DeclareLaunchArgument("disk_path",    default_value="/",
                              description="Filesystem path for disk usage"),

        Node(
            package="saltybot_social",
            executable="sysmon_node",
            name="sysmon_node",
            output="screen",
            parameters=[
                cfg,
                {
                    "publish_rate": LaunchConfiguration("publish_rate"),
                    "disk_path":    LaunchConfiguration("disk_path"),
                },
            ],
        ),
    ])
