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/references/core/rest/places/#queryPlacesNearPoint) and
   * [queryPlacesWithinExtent()](https://developers.arcgis.com/javascript/latest/references/core/rest/places/#queryPlacesWithinExtent) methods.
   *
   * @see [PlaceResult](https://developers.arcgis.com/javascript/latest/references/core/rest/support/PlaceResult/)
   */
  results?: PlaceResultProperties[];
}

/**
 * The `PlacesQueryResult` object includes the results from the
 * [queryPlacesNearPoint()](https://developers.arcgis.com/javascript/latest/references/core/rest/places/#queryPlacesNearPoint) and
 * [queryPlacesWithinExtent()](https://developers.arcgis.com/javascript/latest/references/core/rest/places/#queryPlacesWithinExtent) methods.
 * Along with the [results](https://developers.arcgis.com/javascript/latest/references/core/rest/support/PlacesQueryResult/#results) themselves, the [previous](https://developers.arcgis.com/javascript/latest/references/core/rest/support/PlacesQueryResult/#previousQueryParams) or [next](https://developers.arcgis.com/javascript/latest/references/core/rest/support/PlacesQueryResult/#nextQueryParams) set
 * of query parameters are also included. The results are an array of [PlaceResult](https://developers.arcgis.com/javascript/latest/references/core/rest/support/PlaceResult/)
 * 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/references/core/rest/places/)
 * @see [PlacesParameters](https://developers.arcgis.com/javascript/latest/references/core/rest/support/PlacesParameters/)
 * @see [PlacesQueryParameters](https://developers.arcgis.com/javascript/latest/references/core/rest/support/PlacesQueryParameters/)
 * @see [PlaceResult](https://developers.arcgis.com/javascript/latest/references/core/rest/support/PlaceResult/)
 * @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/references/core/rest/places/#queryPlacesNearPoint) and
   * [queryPlacesWithinExtent()](https://developers.arcgis.com/javascript/latest/references/core/rest/places/#queryPlacesWithinExtent) methods.
   *
   * @see [PlaceResult](https://developers.arcgis.com/javascript/latest/references/core/rest/support/PlaceResult/)
   */
  get results(): PlaceResult[];
  set results(value: PlaceResultProperties[]);
}