// src/util.rs   (or put it directly in main.rs if you prefer)
use tokio::fs;
use std::path::Path;

/// Create the required data folders if they do not exist yet.
pub async fn ensure_data_dirs() -> anyhow::Result<()> {
    let dirs = [
        "economic_events",
        "economic_event_changes",
        "corporate_events",
        "corporate_prices",
        "data",
    ];
    for dir in dirs {
        let path = Path::new(dir);
        if !path.exists() {
            tokio::fs::create_dir_all(path).await?;
            println!("Created directory: {dir}");
        }
    }
    Ok(())
}