use serde::Deserialize;

#[derive(Debug, Default, Deserialize)]
pub struct Http {
    #[serde(default)]
    pub timeout: Option<u64>,
    #[serde(default)]
    pub pool_idle_timeout: Option<u64>,
    #[serde(default)]
    pub pool_max_idle_per_host: Option<usize>,
    #[serde(default)]
    pub local_address: Option<String>,
    #[serde(default)]
    pub tcp_keepalive: Option<u64>,
    #[cfg(feature = "retry")]
    #[serde(default = "default_max_retry")]
    pub max_retry: u32,
}

#[cfg(feature = "retry")]
fn default_max_retry() -> u32 {
    3
}
