use std::path::PathBuf;

use candid::Principal;
use ic_test::{IcpTest, IcpUser};

use crate::bindings::{ {% for c in canisters %}
    {{ c.var_name }}::{self, {{c.service_name}}},{% endfor %}
};

struct Env {
    icp_test: IcpTest,{% for c in canisters %}
    {{ c.var_name }}: {{c.service_name}},{% endfor %}
}

async fn setup(icp_test: IcpTest) -> Env {
    let icp_user = icp_test.icp.test_user(0);

{% for c in canisters %}

    let {{c.var_name}} = {{c.var_name}}::deploy(
        &icp_user,
{% for init_string in c.init_args %}        {{init_string}},
{% endfor %}    )
    .call()
    .await;
{% endfor %}

    // Additional setup steps
    // ...

    Env {
        icp_test,{% for c in canisters %}
        {{ c.var_name }},{% endfor %}
    }
}

#[tokio::test]
async fn test_() {
    let Env {
        icp_test,{% for c in canisters %}
        {{ c.var_name }},{% endfor %}
    } = setup(IcpTest::new().await).await;

    // Your test code
    // ...

    // example calls{% for c in canisters %}
    // let result = {{ c.var_name }}./*canister method name*/().call().await;{% endfor %}

}
