// Tests for mecha10_cli::sim::robot_generator

use mecha10_cli::sim::robot_generator::*;

#[test]
fn test_basic_robot_generation() {
    // This would need a test mecha10.json file
    // Skipping for now, will add in integration tests
}

#[test]
fn test_robot_dimensions() {
    let profile = RobotProfile {
        platform: "differential-drive".to_string(),
        sensors: vec!["camera".to_string(), "lidar".to_string()],
        sensor_configs: vec![],
        task_nodes: vec![],
        capabilities: vec![],
        difficulty_preference: "medium".to_string(),
    };

    let generator = RobotGenerator { profile, rl_mode: true };

    assert_eq!(generator.get_robot_radius(), 0.3);
    assert_eq!(generator.get_robot_height(), 1.0);
}

#[test]
fn test_tscn_header() {
    let profile = RobotProfile {
        platform: "differential-drive".to_string(),
        sensors: vec![],
        sensor_configs: vec![],
        task_nodes: vec![],
        capabilities: vec![],
        difficulty_preference: "medium".to_string(),
    };

    let generator = RobotGenerator {
        profile,
        rl_mode: false,
    };
    let tscn = generator.generate_tscn();

    assert!(tscn.contains("[gd_scene load_steps=3 format=3]"));
    assert!(tscn.contains("[node name=\"Robot\" type=\"CharacterBody3D\"]"));
}

#[test]
fn test_rl_mode_includes_ai_controller() {
    let profile = RobotProfile {
        platform: "differential-drive".to_string(),
        sensors: vec!["camera".to_string()],
        sensor_configs: vec![],
        task_nodes: vec![],
        capabilities: vec![],
        difficulty_preference: "medium".to_string(),
    };

    let generator = RobotGenerator { profile, rl_mode: true };
    let tscn = generator.generate_tscn();

    // Should have more load steps for scripts
    assert!(tscn.contains("[gd_scene load_steps=5 format=3]"));
    // Should have AIController node
    assert!(tscn.contains("[node name=\"AIController3D\""));
    // Should have RoverBaseRL script
    assert!(tscn.contains("rover_base_rl.gd"));
    // Should have RoverAIController script
    assert!(tscn.contains("rover_ai_controller.gd"));
    // Should have CameraRL instead of Camera3D
    assert!(tscn.contains("[node name=\"CameraRL\""));
}
