//! Example: condition-based update via `/gateway/update`.
use athena_rs::AthenaClient;
use serde_json::json;
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 update_result = client
        .update("users")
        .where_eq("workspace_id", "ws_123")
        .where_eq("status", "pending")
        .payload(json!({
            "status": "active",
            "updated_by": "sdk-example"
        }))
        .execute()
        .await?;

    println!("Updated rows: {}", update_result.rows.len());
    Ok(())
}
