import type Accessor from "../../core/Accessor.js";
import type PlaceResult from "./PlaceResult.js";
import type PlacesQueryParameters from "./PlacesQueryParameters.js";
import type { PlaceResultProperties } from "./PlaceResult.js";

export interface PlacesQueryResultProperties extends Partial<Pick<PlacesQueryResult, "nextQueryParams" | "previousQueryParams">> {
  /**
   * An array of results from searching for places using the
   * [queryPlacesNearPoint()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-places.html#queryPlacesNearPoint) and
   * [queryPlacesWithinExtent()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-places.html#queryPlacesWithinExtent) methods.
   *
   * @see [PlaceResult](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PlaceResult.html)
   */
  results?: PlaceResultProperties[];
}

/**
 * The `PlacesQueryResult` object includes the results from the
 * [queryPlacesNearPoint()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-places.html#queryPlacesNearPoint) and
 * [queryPlacesWithinExtent()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-places.html#queryPlacesWithinExtent) methods.
 * Along with the [results](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PlacesQueryResult.html#results) themselves, the [previous](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PlacesQueryResult.html#previousQueryParams) or [next](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PlacesQueryResult.html#nextQueryParams) set
 * of query parameters are also included. The results are an array of [PlaceResult](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PlaceResult.html)
 * objects.
 *
 * @since 4.27
 * @see [Sample -  Find nearby places and details](https://developers.arcgis.com/javascript/latest/sample-code/places/)
 * @see [Introduction to places](https://developers.arcgis.com/documentation/mapping-apis-and-services/places/)
 * @see [Places service](https://developers.arcgis.com/rest/places/)
 * @see [places](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-places.html)
 * @see [PlacesParameters](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PlacesParameters.html)
 * @see [PlacesQueryParameters](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PlacesQueryParameters.html)
 * @see [PlaceResult](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PlaceResult.html)
 * @example
 * const [places, PlacesQueryParameters] = await $arcgis.import([
 *   "@arcgis/core/rest/places.js",
 *   "@arcgis/core/rest/support/PlacesQueryParameters.js"
 * ]);
 * const point = {
 *   type: "point", // autocasts as new Point()
 *   longitude: 17.81840,
 *   latitude: 59.42145
 * };
 *
 * const swedishPlacesQueryParameters = new PlacesQueryParameters({
 *   apiKey: "YOUR_API_KEY",
 *   categoryIds: ["63be6904847c3692a84b9b4c"], // Bathroom Contractor
 *   radius: 10000,  // set radius to 10,000 meters
 *   point
 * });
 *
 * function findPlaces() {
 *   places.queryPlacesNearPoint(swedishPlacesQueryParameters).then(showPlaces);
 * }
 *
 * function showPlaces(placesSolveResult) {
 *   // results from the queryPlacesNearPoint() method
 *   console.log("PlacesQueryResult: ", placesSolveResult);
 * }
 *
 * findPlaces();
 */
export default class PlacesQueryResult extends Accessor {
  constructor(properties?: PlacesQueryResultProperties);
  /** The query parameters for the next set of results. */
  accessor nextQueryParams: PlacesQueryParameters | null | undefined;
  /** The query parameters for the previous set of results. */
  accessor previousQueryParams: PlacesQueryParameters | null | undefined;
  /**
   * An array of results from searching for places using the
   * [queryPlacesNearPoint()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-places.html#queryPlacesNearPoint) and
   * [queryPlacesWithinExtent()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-places.html#queryPlacesWithinExtent) methods.
   *
   * @see [PlaceResult](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PlaceResult.html)
   */
  get results(): PlaceResult[];
  set results(value: PlaceResultProperties[]);
}