//! Application state management

use std::sync::{Arc, Mutex};
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConnectionStatus {
    pub connected: bool,
    pub server: Option<String>,
    pub upload_speed: u64,
    pub download_speed: u64,
    pub ping: u32,
}

impl Default for ConnectionStatus {
    fn default() -> Self {
        Self {
            connected: false,
            server: None,
            upload_speed: 0,
            download_speed: 0,
            ping: 0,
        }
    }
}

pub struct AppState {
    pub status: Arc<Mutex<ConnectionStatus>>,
}

impl AppState {
    pub fn new() -> Self {
        Self {
            status: Arc::new(Mutex::new(ConnectionStatus::default())),
        }
    }
}
