import type Accessor from "../../core/Accessor.js";
import type { GraphAnyValue } from "./GraphAnyValue.js";

export interface GraphQueryResultProperties extends Partial<Pick<GraphQueryResult, "resultRows">> {}

/**
 * The results of a [executeQuery()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraphService.html#executeQuery) or [executeSearch()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraphService.html#executeSearch) on a knowledge graph service.
 *
 * @since 4.25
 * @see [executeQuery()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraphService.html#executeQuery)
 * @see [executeSearch()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraphService.html#executeSearch)
 */
export default class GraphQueryResult extends Accessor {
  constructor(properties?: GraphQueryResultProperties);
  /**
   * An array of the result types that are returned from a search or query. Each item in the `resultRows` array matches the search or query constraints.
   *
   * @example
   * // Example of GraphQueryResult.resultRows returned from a
   * // `MATCH (n:Supplier)-[r]->(m) RETURN [n.id, n.geometry, n, r, m], {var1: n}`
   * // query on a knowledge graph that contains supply chain information
   * KnowledgeGraphModule.executeQuery(
   *  knowledgeGraph, //graph
   *  { //searchArguments
   *    openCypherQuery: "MATCH (n:Supplier)-[r]->(m) RETURN [n.id, n.geometry, n, r, m], {var1: n}",
   *   }).then((queryResult) => {
   *     //do something with the result
   *    console.log(queryResult)
   * });
   * @example
   * //sample result of the above query
   * "resultRows": [
   *  [ //array of result types that meet query criteria
   *    [ //single return type that matches query return format.
   *      1111,
   *      "Point",
   *      {  //Supplier Entity
   *        "properties": {
   *          "Name": "Queen City Steel",
   *        },
   *        "typeName": "Supplier",
   *        "id": "1111"
   *      },
   *      { // 'supplies' relationship between Supplier and Plant
   *        "destinationId": "1111",
   *        "originId": "1236",
   *        "properties": {
   *          "material_supplied": "steel"
   *        },
   *        "typeName": "supplies",
   *        "id": "A268",
   *      },
   *      { //destination entity of 'supplies' for supplier 1111
   *        "properties": {
   *          "Name": "Sky Manufacturing",
   *        },
   *        "typeName": "Plant",
   *        "id": "1236"
   *      }
   *    ],
   *    {  // anonymous object returned by the `{var1:n}` query parameter
   *      "properties": {
   *        "var1": { //the entity (n) returned in the var1 object
   *          "properties": {
   *            "Name": "Queen City Steel",
   *        },
   *          "typeName": "Supplier",
   *          "id": "1111"
   *        }
   *      }
   *    }
   *  ]
   * ]
   */
  accessor resultRows: Array<GraphAnyValue[]>;
}