fn main() -> Result<(), Box<dyn std::error::Error>> {
    // ---- keto proto (tonic-prost client stubs, server=false) ----------------
    let keto_protos = &[
        "proto/ory/keto/relation_tuples/v1alpha2/check_service.proto",
        "proto/ory/keto/relation_tuples/v1alpha2/read_service.proto",
        "proto/ory/keto/relation_tuples/v1alpha2/write_service.proto",
        "proto/ory/keto/relation_tuples/v1alpha2/relation_tuples.proto",
    ];
    let keto_includes = &["proto"];
    tonic_prost_build::configure()
        .build_server(false)
        .build_client(true)
        .compile_protos(keto_protos, keto_includes)?;

    for p in keto_protos {
        println!("cargo:rerun-if-changed={p}");
    }

    // ---- eliza proto (connectrpc-build: buffa messages + service stubs) -----
    connectrpc_build::Config::new()
        .files(&["proto/connectrpc/eliza/v1/eliza.proto"])
        .includes(&["proto"])
        .include_file("_eliza.rs")
        .compile()?;

    println!("cargo:rerun-if-changed=proto/connectrpc/eliza/v1/eliza.proto");

    Ok(())
}
