def METHOD_NAME(foo_model: Model, graph_db: GraphDB) -> None:
    query = 'is(foo) and nested[*].{name=true and inner[*].{name=true}} and parents[*].{some_int="23"}'
    aql, bind_vars = to_query(graph_db, QueryModel(parse_query(query).on_section("reported"), foo_model))
    # query unfolds all nested loops
    assert aql == (
        "LET filter0 = (LET nested_distinct0 = (FOR m0 in `ns`  FOR pre0 IN TO_ARRAY(m0.reported.nested) "
        "FOR pre1 IN TO_ARRAY(pre0.inner)  "
        "FOR pre2 IN TO_ARRAY(m0.reported.parents) "
        "FILTER ((@b0 IN m0.kinds) and ((pre0.name == @b1) and (pre1.name == @b2))) and (pre2.some_int == @b3) "
        "RETURN DISTINCT m0) FOR m1 in nested_distinct0  "
        'RETURN m1) FOR result in filter0 RETURN UNSET(result, ["flat"])'
    )
    # coercing works correctly for context terms
    assert bind_vars["b1"] == "true"  # true is coerced to a string
    assert bind_vars["b2"] == "true"  # inner true is coerced to a string
    assert bind_vars["b3"] == 23  # 23 is coerced to an int
    # fixed index works as well
    query = "is(foo) and inner[1].{name=true and inner[0].name==true}"
    aql, bind_vars = to_query(graph_db, QueryModel(parse_query(query).on_section("reported"), foo_model))
    assert aql == (
        "LET filter0 = (FOR m0 in `ns` FILTER (@b0 IN m0.kinds) and "
        "((m0.reported.inner[1].name == @b1) and (m0.reported.inner[1].inner[0].name == @b2))  RETURN m0) "
        'FOR result in filter0 RETURN UNSET(result, ["flat"])'
    )