//! Example: insert a row via `/gateway/insert`.
use athena_rs::AthenaClient;
use athena_rs::client::backend::QueryResult;
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 insert_result: QueryResult = client
        .insert("users")
        .payload(json!({
            "email": "new.user@example.com",
            "status": "active",
            "name": "New User"
        }))
        .execute()
        .await?;

    println!("Inserted rows: {}", insert_result.rows.len());
    Ok(())
}
