import type SpatialReference from "../../geometry/SpatialReference.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
import type { SpatialReferenceProperties } from "../../geometry/SpatialReference.js";

export interface FindParametersProperties extends Partial<Pick<FindParameters, "contains" | "gdbVersion" | "geometryPrecision" | "layerIds" | "maxAllowableOffset" | "returnGeometry" | "searchFields" | "searchText">> {
  /**
   * The spatial reference of the output geometries. If this is not specified, the output geometries are returned
   * in the spatial reference of the map.
   */
  outSpatialReference?: SpatialReferenceProperties | null;
}

/**
 * Input parameters for [find](https://developers.arcgis.com/javascript/latest/references/core/rest/find/).
 *
 * @since 4.20
 * @see [find](https://developers.arcgis.com/javascript/latest/references/core/rest/find/)
 * @see [FindResult](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FindResult/)
 */
export default class FindParameters extends JSONSupport {
  constructor(properties?: FindParametersProperties);
  /**
   * Determines whether to look for an exact match of the search text or not.
   * If `true`, searches for a value that contains the provided [searchText](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FindParameters/#searchText). This is a case-insensitive search.
   * If `false`, searches for an exact match of the [searchText](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FindParameters/#searchText) string. The exact match is case-sensitive.
   *
   * @default true
   */
  accessor contains: boolean;
  /** Specify the geodatabase version to search. */
  accessor gdbVersion: string | null | undefined;
  /** Specify the number of decimal places for the geometries returned by the task. */
  accessor geometryPrecision: number | null | undefined;
  /**
   * The layers to perform the find operation on. The layers are specified as a comma-separated list of layer ids.
   * The list of ids is returned in [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/) layerInfos.
   *
   * @example findParams.layerIds = [0];
   */
  accessor layerIds: number[] | null | undefined;
  /**
   * The maximum allowable offset used for generalizing geometries returned by the find operation. The offset is
   * in the units of [outSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FindParameters/#outSpatialReference). If [outSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FindParameters/#outSpatialReference)
   * is not defined, the spatial reference of the map is used.
   */
  accessor maxAllowableOffset: number | null | undefined;
  /**
   * The spatial reference of the output geometries. If this is not specified, the output geometries are returned
   * in the spatial reference of the map.
   */
  get outSpatialReference(): SpatialReference | null | undefined;
  set outSpatialReference(value: SpatialReferenceProperties | null | undefined);
  /**
   * If `true`, the output will include the geometry associated with each result.
   *
   * @default false
   */
  accessor returnGeometry: boolean;
  /**
   * The names of the fields of a layer to search. The fields are specified as a comma-separated list of field names.
   * If this parameter is not specified, all fields are searched by default.
   */
  accessor searchFields: string[] | null | undefined;
  /**
   * The text that is searched across the layers and the fields as specified in the `layers` and
   * [searchFields](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FindParameters/#searchFields) properties.
   */
  accessor searchText: string | null | undefined;
}