use anyhow::Result;
use reqwest::Client;
use std::time::Duration;

pub struct LeagueApiClient {
    client: Client,
    base_url: String,
    api_key: String,
}

impl LeagueApiClient {
    pub fn new(base_url: &str, api_key: &str, timeout_secs: u64) -> Result<Self> {
        let client = Client::builder()
            .timeout(Duration::from_secs(timeout_secs))
            .build()?;

        Ok(Self {
            client,
            base_url: base_url.trim_end_matches('/').to_string(),
            api_key: api_key.to_string(),
        })
    }
}
