/**
 * Search a map service exposed by the ArcGIS Server REST API based on a string value. The search
 * can be conducted on a single field of a single layer, on many fields of a layer, or on many
 * fields of many layers.
 *
 * Use [FindParameters](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FindParameters/) to set the parameters of the method.
 * The result will be an instance of [FindResult](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FindResult/).
 *
 * > [!WARNING]
 * >
 * > **Known Limitations**
 * >
 * > The find operation is currently not supported if attempting to be used:
 * > in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/)
 * > with [dynamic layers](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/#dynamic-layers)
 *
 * @since 4.19
 * @see [FindParameters](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FindParameters/)
 * @see [FindResult](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FindResult/)
 * @see [Sample - Find](https://developers.arcgis.com/javascript/latest/sample-code/find/)
 */
import type FindParameters from "./support/FindParameters.js";
import type FindResult from "./support/FindResult.js";
import type { RequestOptions } from "../request/types.js";
import type { FindParametersProperties } from "./support/FindParameters.js";

export interface FindResults {
  /** An array of objects containing the result features of the find() method. */
  results: FindResult[];
  /** Included in the response only if the result exceeded the transfer limit. */
  exceededTransferLimit?: boolean;
}

/**
 * Sends a request to the ArcGIS REST map service resource to perform a search based on the input
 * [parameters](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FindParameters/).
 *
 * @param url - URL to the ArcGIS Server REST resource that represents a map service.
 * @param parameters - Specifies the layers and fields that are used for the search.
 * @param requestOptions - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/#request) to be used for the data request.
 * @example
 * let parameters = new FindParameters({
 *   layerIds: [0],
 *   searchFields: ["areaname"],
 *   outSpatialReference: { wkid: 4326 },
 *   returnGeometry: true
 * });
 * find(url, parameters).then(function(results){
 *   // Results contain FindResults of search
 * });
 */
export function find(url: string, parameters: FindParameters | FindParametersProperties, requestOptions?: RequestOptions): Promise<FindResults>;