"""Photo capture launch file (Issue #456)."""

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


def generate_launch_description():
    return LaunchDescription([
        DeclareLaunchArgument('photo_dir',
            default_value='/home/seb/saltybot-data/photos/',
            description='Directory for photo storage'),
        DeclareLaunchArgument('max_storage_gb',
            default_value='10.0',
            description='Maximum storage capacity (GB)'),
        DeclareLaunchArgument('timelapse_interval',
            default_value='30.0',
            description='Timelapse interval (seconds)'),
        DeclareLaunchArgument('enable_timelapse',
            default_value='true',
            description='Enable timelapse mode'),
        DeclareLaunchArgument('enable_event_capture',
            default_value='true',
            description='Enable event-triggered capture'),
        DeclareLaunchArgument('enable_gps_overlay',
            default_value='false',
            description='Add GPS overlay to photos'),
        DeclareLaunchArgument('enable_nas_sync',
            default_value='false',
            description='Enable WiFi sync to NAS'),
        DeclareLaunchArgument('nas_path',
            default_value='/mnt/nas/saltybot-photos/',
            description='NAS mount path'),
        DeclareLaunchArgument('quality',
            default_value='95',
            description='JPEG quality (1-100)'),

        Node(
            package='saltybot_photo_capture',
            executable='photo_capture_node',
            name='photo_capture_node',
            output='screen',
            parameters=[{
                'photo_dir': LaunchConfiguration('photo_dir'),
                'max_storage_gb': LaunchConfiguration('max_storage_gb'),
                'timelapse_interval': LaunchConfiguration('timelapse_interval'),
                'enable_timelapse': LaunchConfiguration('enable_timelapse'),
                'enable_event_capture': LaunchConfiguration('enable_event_capture'),
                'enable_gps_overlay': LaunchConfiguration('enable_gps_overlay'),
                'enable_nas_sync': LaunchConfiguration('enable_nas_sync'),
                'nas_path': LaunchConfiguration('nas_path'),
                'quality': LaunchConfiguration('quality'),
            }],
        ),
    ])
