use serde::Deserialize;
use swym_dal::config::DatabaseConfig;

#[derive(Debug, Deserialize)]
pub struct ApiConfig {
    pub database: DatabaseConfig,

    /// Host to bind the HTTP server to
    #[serde(default = "default_host")]
    pub host: String,

    /// Port to bind the HTTP server to
    #[serde(default = "default_port")]
    pub port: u16,
}

fn default_host() -> String {
    "0.0.0.0".to_owned()
}

fn default_port() -> u16 {
    3000
}
