//! Web server utilities

use rustelo_core::Result;

/// Web server configuration
#[derive(Debug, Clone)]
pub struct ServerConfig {
    /// Host to bind to
    pub host: String,
    /// Port to bind to
    pub port: u16,
    /// Enable TLS
    pub tls: bool,
}

/// Web server
pub struct Server {
    config: ServerConfig,
}

impl Server {
    /// Create a new server
    pub fn new(config: ServerConfig) -> Self {
        Self { config }
    }

    /// Start the server
    pub async fn start(&self) -> Result<()> {
        tracing::info!(
            "Starting server on {}:{}",
            self.config.host,
            self.config.port
        );
        // TODO: Implement actual server startup
        Ok(())
    }
}

impl Default for ServerConfig {
    fn default() -> Self {
        Self {
            host: "0.0.0.0".to_string(),
            port: 3030,
            tls: false,
        }
    }
}
