use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Default)]
pub struct AgentMetrics {
    pub hostname: String,
    pub ip: String,
    pub status: String,
    #[serde(default)]
    pub version: String,
    pub cpu_percent: Option<f32>,
    pub memory_used: Option<u64>,
    pub memory_free: Option<u64>,
    pub memory_total: Option<u64>,
    pub hdd_used: Option<u64>,
    pub hdd_free: Option<u64>,
    pub hdd_total: Option<u64>,
    pub uptime: Option<u64>,
    pub network_rx: Option<u64>,
    pub network_tx: Option<u64>,
    pub temperature: Option<f32>,
    pub smart: Option<Vec<SmartMetrics>>,
    pub network_info: Option<Vec<NetworkInterface>>,
    pub hardware_info: Option<HardwareInfo>,
}

#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct NetworkInterface {
    pub name: String,
    pub if_type: String,
    pub speed_mbps: Option<i64>,
    pub mac: String,
    pub wol: Option<bool>,
    pub iperf_mbps: Option<f64>,
}

#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct HardwareInfo {
    pub motherboard_vendor: Option<String>,
    pub motherboard_model: Option<String>,
    pub cpu_model: Option<String>,
    pub ram_type: Option<String>,
    pub ram_speed_mhz: Option<i64>,
    pub ram_slots_used: Option<i64>,
    pub ram_slots_total: Option<i64>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SmartMetrics {
    #[serde(default)]
    pub device: String,
    pub passed: bool,
    pub temperature: Option<i64>,
    pub reallocated_sectors: Option<i64>,
    pub power_on_hours: Option<i64>,
    pub wear_level: Option<i64>,
}
