//! Example: fetch rows with builder filters via `/gateway/fetch`.
use athena_rs::client::backend::QueryResult;
use athena_rs::{AthenaClient, OrderDirection};

use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let client: AthenaClient =
        AthenaClient::new("http://localhost:4052", "secret", "reporting").await?;

    let result: QueryResult = client
        .fetch("users")
        .columns(["id", "email", "created_at"])
        .where_eq("status", "active")
        .where_neq("role", "banned")
        .order_by("created_at", OrderDirection::Desc)
        .limit(25)
        .offset(0)
        .execute()
        .await?;

    println!("Rows: {}", result.rows.len());
    println!("Columns: {:?}", result.columns);
    Ok(())
}
