pub struct AppConfig {
    pub endpoint: String,
    pub token: String,
    pub timeout: u64,
}

pub struct AppBuilder {
    endpoint: Option<String>,
    token: Option<String>,
}

impl AppBuilder {
    fn validate(&self) -> Result<(), &'static str> {
        if self.endpoint.is_none() || self.token.is_none() {
            return Err("missing required field");
        }
        Ok(())
    }

    pub fn build(self) -> Result<AppConfig, &'static str> {
        self.validate()?;
        Ok(AppConfig {
            endpoint: self.endpoint.ok_or("endpoint")?,
            token: self.token.ok_or("token")?,
            timeout: 30,
        })
    }
}

pub enum Mode {
    Verbose,
    Quiet,
}

pub fn new_client(mode: Mode) -> AppConfig {
    let _ = mode;
    AppConfig {
        endpoint: "https://example.com".to_string(),
        token: "token".to_string(),
        timeout: 30,
    }
}

pub enum SessionState {
    Idle,
    Running,
    Ready,
}