use super::device::Device;
use super::cpu::Cpu;

pub struct DeviceManager {
    devices: Vec<Box<dyn Device>>,
}

impl DeviceManager {
    pub fn new() -> Self {
        DeviceManager { devices: Vec::new() }
    }

    pub fn discover_devices(&mut self) {
        // Real implementation: Always add Host CPU
        self.devices.push(Box::new(Cpu::new()));
        
        // TODO: Add real GPU discovery logic (e.g., check for /dev/nvidia0 or similar)
        // For now, we only register the CPU to ensure no "fake" devices are listed.
    }

    pub fn list_devices(&self) {
        for (i, dev) in self.devices.iter().enumerate() {
            println!("[{}] {} ({:?}) - Memory: {}", i, dev.name(), dev.device_type(), dev.memory_info());
        }
    }
}
