/// Configuration module
/// Handles application configuration loading and management
use crate::error::Result;

#[derive(Debug, Clone)]
pub struct Config {
    pub verbose: bool,
}

impl Config {
    /// Create a new configuration with default values
    pub fn new() -> Self {
        Self { verbose: false }
    }

    /// Create configuration from CLI arguments
    pub fn from_cli(verbose: bool) -> Self {
        Self { verbose }
    }
}

impl Default for Config {
    fn default() -> Self {
        Self::new()
    }
}

/// Load configuration
pub fn load(verbose: bool) -> Result<Config> {
    Ok(Config::from_cli(verbose))
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_default_config() {
        let config = Config::default();
        assert!(!config.verbose);
    }

    #[test]
    fn test_from_cli() {
        let config = Config::from_cli(true);
        assert!(config.verbose);
    }
}
