#!/usr/bin/env python3
"""
MageDok 7" Display Launch Configuration
- Video: DisplayPort → HDMI (1024×600)
- Touch: USB HID
- Audio: HDMI → internal speakers via PulseAudio
"""

import os
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import ExecuteProcess


def generate_launch_description():
    return LaunchDescription([
        # Log startup
        ExecuteProcess(
            cmd=['echo', '[MageDok] Display setup starting...'],
            shell=True,
        ),

        # Verify display resolution
        Node(
            package='saltybot_bringup',
            executable='verify_display.py',
            name='display_verifier',
            parameters=[
                {'target_width': 1024},
                {'target_height': 600},
                {'target_refresh': 60},
            ],
            output='screen',
        ),

        # Monitor touch input
        Node(
            package='saltybot_bringup',
            executable='touch_monitor.py',
            name='touch_monitor',
            parameters=[
                {'device_name': 'MageDok Touch'},
                {'poll_interval': 0.1},
            ],
            output='screen',
        ),

        # Audio routing (PulseAudio sink redirection)
        Node(
            package='saltybot_bringup',
            executable='audio_router.py',
            name='audio_router',
            parameters=[
                {'hdmi_sink': 'alsa_output.pci-0000_00_1d.0.hdmi-stereo'},
                {'default_sink': True},
            ],
            output='screen',
        ),
    ])
