#![allow(dead_code)]
//! Robot control and connection commands

use anyhow::Result;
use dialoguer::{Confirm, Input};

/// Teleoperate robot
pub async fn teleoperate() -> Result<()> {
    println!("\n╭─────────────────────────────────────────╮");
    println!("│  Teleoperate Robot                       │");
    println!("╰─────────────────────────────────────────╯\n");
    println!("  Switching to teleoperation mode...");
    println!("  Feature coming soon - will enable keyboard/joystick control");
    println!("  Controls:");
    println!("    WASD - Movement");
    println!("    Arrow Keys - Camera");
    println!("    Space - Stop");
    println!("    Esc - Exit teleoperation");
    Ok(())
}

/// Connect to real robot
pub async fn connect_robot() -> Result<()> {
    println!("\n╭─────────────────────────────────────────╮");
    println!("│  Connect to Real Robot                   │");
    println!("╰─────────────────────────────────────────╯\n");

    let ip: String = Input::new()
        .with_prompt("Robot IP address")
        .default("192.168.1.100".to_string())
        .interact_text()?;

    let port: u16 = Input::new().with_prompt("Robot port").default(8080).interact_text()?;

    let should_save = Confirm::new()
        .with_prompt("Save this configuration?")
        .default(true)
        .interact()?;

    println!("  Connecting to robot at {}:{}...", ip, port);
    println!("  Feature coming soon - will establish connection to robot");

    if should_save {
        println!("  Configuration saved to .mecha10/robot-connection.json");
    }

    Ok(())
}
