import type Graphic from "../../Graphic.js";
import type PopupTemplate from "../../PopupTemplate.js";
import type Collection from "../../core/Collection.js";
import type Point from "../../geometry/Point.js";
import type Portal from "../../portal/Portal.js";
import type { EventedAccessor } from "../../core/Evented.js";
import type { AbortOptions } from "../../core/promiseUtils.js";
import type { MapViewOrSceneView } from "../../views/MapViewOrSceneView.js";
import type { SearchItem, SearchResult, SuggestResult, SupportedSearchSource, SearchResponse, SuggestResponse, SearchResults, SuggestResults, SearchDefaultSymbols, SourcesHandler } from "./types.js";
import type { GoTo, GoToProperties } from "../support/GoTo.js";
import type { PopupTemplateProperties } from "../../PopupTemplate.js";
import type { PortalProperties } from "../../portal/Portal.js";
import type { LayerSearchSourceProperties } from "./LayerSearchSource.js";
import type { LocatorSearchSourceProperties } from "./LocatorSearchSource.js";
import type { ReadonlyArrayOrCollection } from "../../core/Collection.js";

export interface SearchViewModelProperties extends GoToProperties, Partial<Pick<SearchViewModel, "allPlaceholder" | "autoNavigate" | "autoSelect" | "defaultSymbols" | "includeDefaultSources" | "locationEnabled" | "maxInputLength" | "maxResults" | "maxSuggestions" | "messages" | "minSuggestCharacters" | "popupEnabled" | "resultCount" | "resultGraphicEnabled" | "searchAllEnabled" | "suggestionCount" | "suggestionDelay" | "suggestionsEnabled" | "view">> {
  /**
   * The selected source's index. This value is `-1` when all sources are selected.
   *
   * @default 0
   */
  activeSourceIndex?: number | null;
  /**
   * The default popupTemplate.
   *
   * @since 4.32
   */
  defaultPopupTemplate?: PopupTemplateProperties | null;
  /**
   * A customized [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html) for the selected feature.
   * Note that any [templates](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html)
   * defined on [allSources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#allSources) take precedence over those defined directly on the template.
   */
  popupTemplate?: PopupTemplateProperties | null;
  /**
   * It is possible to search a specified portal instance's [locator services](https://enterprise.arcgis.com/en/portal/latest/administer/windows/configure-portal-to-geocode-addresses.htm)
   * Use this property to set this [ArcGIS Portal](https://enterprise.arcgis.com/en/portal/) instance to search.
   *
   * @since 4.8
   */
  portal?: PortalProperties | null;
  /** The value of the search box input text string. */
  searchTerm?: string | null;
  /**
   * Search may be used to search features in a
   * [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) or [table](https://developers.arcgis.com/javascript/latest/api-reference/esri-webdoc-applicationProperties-SearchTable.html),
   * or geocode locations with a [locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html). The `sources` property defines the sources from which
   * to search for the [view](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#view) specified by the Search instance. There are two types of sources:
   *
   * * [LayerSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LayerSearchSource.html)
   * * [LocatorSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html)
   *
   * Any combination of these sources may be used
   * together in the same instance of Search.
   *
   * @example
   * // Default sources[] when sources is not specified
   * [
   *   {
   *     url: "https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer",
   *     singleLineFieldName: "SingleLine",
   *     outFields: ["Addr_type"],
   *     name: "ArcGIS World Geocoding Service",
   *     placeholder: "Adresse",
   *     resultSymbol: {
   *        type: "picture-marker",  // autocasts as new PictureMarkerSymbol()
   *        url: this.basePath + "/images/search/search-symbol-32.png",
   *        size: 24,
   *        width: 24,
   *        height: 24,
   *        xoffset: 0,
   *        yoffset: 0
   *    }
   *   }
   * ]
   * @example
   * // Example of multiple sources[]
   * let sources = [
   * {
   *   url: "https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer",
   *   singleLineFieldName: "SingleLine",
   *   name: "Custom Geocoding Service",
   *   placeholder: "Search Geocoder",
   *   maxResults: 3,
   *   maxSuggestions: 6,
   *   suggestionsEnabled: false,
   *   minSuggestCharacters: 0
   * }, {
   *   layer: new FeatureLayer({
   *     url: "https://services.arcgis.com/DO4gTjwJVIJ7O9Ca/arcgis/rest/services/GeoForm_Survey_v11_live/FeatureServer/0",
   *     outFields: ["*"]
   *   }),
   *   searchFields: ["Email", "URL"],
   *   displayField: "Email",
   *   exactMatch: false,
   *   outFields: ["*"],
   *   name: "Point FS",
   *   placeholder: "example: esri",
   *   maxResults: 6,
   *   maxSuggestions: 6,
   *   suggestionsEnabled: true,
   *   minSuggestCharacters: 0
   * },
   * {
   *   layer: new FeatureLayer({
   *     outFields: ["*"]
   *   });
   *   placeholder: "esri",
   *   name: "A FeatureLayer",
   *   prefix: "",
   *   suffix: "",
   *   maxResults: 1,
   *   maxSuggestions: 6,
   *   exactMatch: false,
   *   searchFields: [], // defaults to FeatureLayer.displayField
   *   displayField: "", // defaults to FeatureLayer.displayField
   *   minSuggestCharacters: 0
   * }
   * ];
   * @example
   * let sources = [{ ... }, { ... }, { ... }]; // array of sources
   * searchViewModel.sources = sources;
   *
   * // Add to source(s)
   * searchViewModel.sources.push({ ... });  // new source
   */
  sources?: ReadonlyArrayOrCollection<(LocatorSearchSourceProperties | LayerSearchSourceProperties)>;
}

export type SearchViewModelState = "disabled" | "ready" | "searching" | "loading";

export interface SearchViewModelEvents {
  /**
   * Fires when the [Search.search()](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#search) method starts.
   *
   * @example
   * const searchWidget = new Search();
   *
   * searchWidget.on("search-start", function(event){
   *   console.log("Search started.");
   * });
   */
  "search-start": void;
  /**
   * Fires when the [Search.search()](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#search) method is called and returns its results.
   *
   * @example
   * const searchWidget = new Search();
   *
   * searchWidget.on("search-complete", function(event){
   *   // The results are stored in the event Object[]
   *   console.log("Results of the search: ", event);
   * });
   */
  "search-complete": SearchResponse;
  /**
   * Fires when a search result is selected.
   *
   * @example
   * const searchWidget = new Search();
   *
   * searchWidget.on("select-result", function(event){
   *   console.log("The selected search result: ", event);
   * });
   */
  "select-result": SearchViewModelSelectResultEvent;
  /**
   * Fires when the [Search.suggest()](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#suggest) method starts.
   *
   * @example
   * const searchWidget = new Search();
   *
   * searchWidget.on("suggest-start", function(event){
   *   console.log("suggest-start", event);
   * });
   */
  "suggest-start": { searchTerm: string; };
  /**
   * Fires when the [Search.suggest()](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#suggest) method is called and returns its results.
   *
   * @example
   * const searchWidget = new Search();
   *
   * searchWidget.on("suggest-complete", function(event){
   *   // The results are stored in the event Object[]
   *   console.log("Results of suggest: ", event);
   * });
   */
  "suggest-complete": SuggestResponse | null;
  /**
   * Fires when a result is cleared from the input box or a new result is selected.
   *
   * @example
   * const searchWidget = new Search();
   *
   * searchWidget.on("search-clear", function(event){
   *   console.log("Search input textbox was cleared.");
   * });
   */
  "search-clear": void;
}

export interface SearchViewModelSelectResultEvent {
  /** Whether the popup is enabled for the selected result. */
  popupEnabled: boolean;
  /** An object containing the results of the search. */
  result: SearchResult;
  /**
   * The source of the selected result. Please see [Search.sources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#sources) for
   * additional information on its properties.
   */
  source: SupportedSearchSource;
  /** The index of the source of the selected result. */
  sourceIndex?: number | null;
}

/**
 * Provides the logic for the [Search widget](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html) and [Search component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-search/), which performs search
 * operations on [locator service(s)](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html),
 * [map](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html)/[feature](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) service feature
 * layer(s), and/or [table(s)](https://developers.arcgis.com/javascript/latest/api-reference/esri-webdoc-applicationProperties-SearchTable.html).
 * If using a locator with a geocoding service, the
 * [findAddressCandidates](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-find-address-candidates.htm)
 * operation is used, whereas [queries](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html) are used on feature layers.
 *
 * @since 4.0
 * @see [Search widget](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html) - _Deprecated since 4.33. Use the [Search component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-search/) instead._
 * @see [Search component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-search/)
 * @see [Sample - Search component with multiple sources](https://developers.arcgis.com/javascript/latest/sample-code/search-component-multisource/)
 * @see [Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern)
 * @see [locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html)
 * @see [Layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html)
 */
export default class SearchViewModel extends SearchViewModelSuperclass {
  /**
   * @deprecated
   * Do not directly reference this property.
   * Use EventNames and EventTypes helpers from \@arcgis/core/Evented
   */
  "@eventTypes": SearchViewModelEvents;
  constructor(properties?: SearchViewModelProperties);
  /**
   * The [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources) object currently selected. Can be either a
   * [feature layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html) or a [locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html).
   */
  get activeSource(): SupportedSearchSource | null | undefined;
  /**
   * The selected source's index. This value is `-1` when all sources are selected.
   *
   * @default 0
   */
  get activeSourceIndex(): number;
  set activeSourceIndex(value: number | null | undefined);
  /**
   * String value used as a hint for input text when searching on multiple sources. See
   * the image below to view the location and style of this text.
   *
   * ![search-allPlaceholder](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-allplaceholder.png)
   *
   * @default "Find address or place"
   */
  accessor allPlaceholder: string | null | undefined;
  /**
   * The combined collection of [defaultSources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#defaultSources)
   * and [sources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources).
   * The [defaultSources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#defaultSources)
   * displays first in the Search UI.
   *
   * @since 4.8
   */
  get allSources(): Collection<SupportedSearchSource>;
  /**
   * Indicates whether to automatically navigate to the selected result.
   *
   * @default true
   * @since 4.32
   */
  accessor autoNavigate: boolean;
  /**
   * Indicates whether to automatically select and zoom to the first geocoded result. If `false`, the
   * [findAddressCandidates](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-find-address-candidates.htm)
   * operation will still geocode the input string, but the top result will not be selected. To work with the
   * geocoded results, you can set up a [@search-complete](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#event-search-complete) event handler and get the results
   * through the event object.
   *
   * @default true
   */
  accessor autoSelect: boolean;
  /**
   * The default popupTemplate.
   *
   * @since 4.32
   */
  get defaultPopupTemplate(): PopupTemplate | null | undefined;
  set defaultPopupTemplate(value: PopupTemplateProperties | null | undefined);
  /**
   * A read-only property that is a [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html)
   * of [LayerSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LayerSearchSource.html)
   * and/or [LocatorSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html). This property
   * may contain [ArcGIS Portal](https://enterprise.arcgis.com/en/portal/)
   * [locators](https://enterprise.arcgis.com/en/server/latest/publish-services/windows/geocode-services.htm)
   * and any web map or web scene [configurable search sources](https://doc.arcgis.com/en/arcgis-online/create-maps/configure-feature-search.htm).
   * Web maps or web scenes may contain
   * [map](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html)/[feature](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) service feature
   * layer(s), and/or [table(s)](https://developers.arcgis.com/javascript/latest/api-reference/esri-webdoc-applicationProperties-SearchTable.html) as sources.
   *
   * This property is used to populate the Search UI if the [sources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources) property is not set.
   *
   * @since 4.8
   */
  get defaultSources(): Collection<SupportedSearchSource>;
  /**
   * The default [symbol(s)](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Symbol.html) for the search result.
   * Choosing a symbol depends on the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html) type (SceneView or MapView),
   * and the [geometry type](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html#type) of the search result.
   * This property allows developers to overwrite the default symbology for one or more geometry types.
   *
   * @since 4.22
   * @example
   * searchViewModel.defaultSymbols = {
   *    point: new PictureMarkerSymbol({
   *       url: "https://freesvg.org/img/1287178070.png",
   *       size: 24,
   *       width: 24,
   *       height: 24
   *    }),
   *    polygon: new SimpleFillSymbol({
   *       color: [235, 235, 235, 0.4],
   *       outline: {
   *          color: [130, 130, 130, 1],
   *          width: 2
   *       }
   *    }),
   *    polyline: new SimpleLineSymbol({
   *       color: [130, 130, 130, 1],
   *       width: 2
   *    })
   * };
   */
  accessor defaultSymbols: SearchDefaultSymbols;
  /**
   * Indicates whether or not to include [defaultSources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#defaultSources) in the Search UI.
   * This can be a boolean value or a function that returns an array of Search [sources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources).
   *
   * @default true
   * @since 4.8
   * @example
   * // includeDefaultSources passed as a boolean value
   * searchViewModel.includeDefaultSources = false;
   *
   * // includeDefaultSources passed as a function
   * searchViewModel.includeDefaultSources = function(sourcesResponse) {
   *     return sourcesResponse.defaultSources;
   * };
   */
  accessor includeDefaultSources: boolean | SourcesHandler;
  /**
   * Indicates whether location services are enabled.
   *
   * ![locationEnabled](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-locationEnabled.png)
   *
   * > [!WARNING]
   * >
   * > The use of this property is only supported on secure origins.
   * > To use it, switch your application to a secure origin, such as HTTPS.
   * > Note that localhost is considered "potentially secure" and can be used
   * > for easy testing in browsers that supports [Window.isSecureContext](https://developer.mozilla.org/en-US/docs/Web/API/isSecureContext#browser_compatibility)
   * > (currently Chrome and Firefox).
   *
   * @since 4.8
   */
  accessor locationEnabled: boolean;
  /**
   * The maximum character length of the search text.
   *
   * @default 128
   */
  accessor maxInputLength: number;
  /**
   * The maximum number of results returned if not specified by the source.
   *
   * @default 6
   */
  accessor maxResults: number;
  /**
   * The maximum number of suggestions returned if not specified by the source.
   *
   * If working with the default
   * [ArcGIS Online Geocoding service](https://developers.arcgis.com/rest/geocode/api-reference/overview-world-geocoding-service.htm),
   * the default remains at `5`.
   *
   * @default 6
   */
  accessor maxSuggestions: number;
  /** The associated message bundle. */
  accessor messages: Record<string, unknown> | null | undefined;
  /**
   * The minimum number of characters needed for the search if not specified by the source.
   *
   * @default 3
   */
  accessor minSuggestCharacters: number;
  /** The placeholder used by the [activeSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#activeSource). */
  get placeholder(): string;
  /**
   * Indicates whether to display the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) on feature click. The graphic can
   * be clicked to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html).
   *
   * @default true
   */
  accessor popupEnabled: boolean;
  /**
   * A customized [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html) for the selected feature.
   * Note that any [templates](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html)
   * defined on [allSources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#allSources) take precedence over those defined directly on the template.
   */
  get popupTemplate(): PopupTemplate | null | undefined;
  set popupTemplate(value: PopupTemplateProperties | null | undefined);
  /**
   * It is possible to search a specified portal instance's [locator services](https://enterprise.arcgis.com/en/portal/latest/administer/windows/configure-portal-to-geocode-addresses.htm)
   * Use this property to set this [ArcGIS Portal](https://enterprise.arcgis.com/en/portal/) instance to search.
   *
   * @since 4.8
   */
  get portal(): Portal | null | undefined;
  set portal(value: PortalProperties | null | undefined);
  /**
   * The number of results found in the search.
   *
   * @since 4.32
   */
  accessor resultCount: number | null | undefined;
  /** The graphic used to highlight the resulting feature or location. */
  get resultGraphic(): Graphic | null | undefined;
  /**
   * Indicates if the [resultGraphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#resultGraphic) will display at the
   * location of the selected feature.
   *
   * > [!CAUTION]
   * >
   * > A graphic will be placed in the View's
   * > [View.graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#graphics)
   * > for [layer views](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html)
   * > that do not support the `highlight` method.
   *
   * @default true
   */
  accessor resultGraphicEnabled: boolean;
  /** The point used to show a popup for the result graphic. */
  get resultLocation(): Point | null | undefined;
  /** An array of current results from the search. */
  get results(): SearchResults[] | null | undefined;
  /**
   * Indicates whether to display the option to search all sources. When `true`, the "All" option
   * is displayed by default:
   *
   * ![search-searchAllEnabled-true](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-enablesearchingall-true.png)
   *
   * When `false`, no option to search all sources at once is available:
   *
   * ![search-searchAllEnabled-true-false](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-enablesearchingall-false.png)
   *
   * @default true
   */
  accessor searchAllEnabled: boolean;
  /** The value of the search box input text string. */
  get searchTerm(): string;
  set searchTerm(value: string | null | undefined);
  /** The result selected from a search. */
  get selectedResult(): SearchResult | null | undefined;
  /** The selected [SuggestResult](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-types.html#SuggestResult). */
  get selectedSuggestion(): SuggestResult | null | undefined;
  /**
   * Search may be used to search features in a
   * [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) or [table](https://developers.arcgis.com/javascript/latest/api-reference/esri-webdoc-applicationProperties-SearchTable.html),
   * or geocode locations with a [locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html). The `sources` property defines the sources from which
   * to search for the [view](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#view) specified by the Search instance. There are two types of sources:
   *
   * * [LayerSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LayerSearchSource.html)
   * * [LocatorSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html)
   *
   * Any combination of these sources may be used
   * together in the same instance of Search.
   *
   * @example
   * // Default sources[] when sources is not specified
   * [
   *   {
   *     url: "https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer",
   *     singleLineFieldName: "SingleLine",
   *     outFields: ["Addr_type"],
   *     name: "ArcGIS World Geocoding Service",
   *     placeholder: "Adresse",
   *     resultSymbol: {
   *        type: "picture-marker",  // autocasts as new PictureMarkerSymbol()
   *        url: this.basePath + "/images/search/search-symbol-32.png",
   *        size: 24,
   *        width: 24,
   *        height: 24,
   *        xoffset: 0,
   *        yoffset: 0
   *    }
   *   }
   * ]
   * @example
   * // Example of multiple sources[]
   * let sources = [
   * {
   *   url: "https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer",
   *   singleLineFieldName: "SingleLine",
   *   name: "Custom Geocoding Service",
   *   placeholder: "Search Geocoder",
   *   maxResults: 3,
   *   maxSuggestions: 6,
   *   suggestionsEnabled: false,
   *   minSuggestCharacters: 0
   * }, {
   *   layer: new FeatureLayer({
   *     url: "https://services.arcgis.com/DO4gTjwJVIJ7O9Ca/arcgis/rest/services/GeoForm_Survey_v11_live/FeatureServer/0",
   *     outFields: ["*"]
   *   }),
   *   searchFields: ["Email", "URL"],
   *   displayField: "Email",
   *   exactMatch: false,
   *   outFields: ["*"],
   *   name: "Point FS",
   *   placeholder: "example: esri",
   *   maxResults: 6,
   *   maxSuggestions: 6,
   *   suggestionsEnabled: true,
   *   minSuggestCharacters: 0
   * },
   * {
   *   layer: new FeatureLayer({
   *     outFields: ["*"]
   *   });
   *   placeholder: "esri",
   *   name: "A FeatureLayer",
   *   prefix: "",
   *   suffix: "",
   *   maxResults: 1,
   *   maxSuggestions: 6,
   *   exactMatch: false,
   *   searchFields: [], // defaults to FeatureLayer.displayField
   *   displayField: "", // defaults to FeatureLayer.displayField
   *   minSuggestCharacters: 0
   * }
   * ];
   * @example
   * let sources = [{ ... }, { ... }, { ... }]; // array of sources
   * searchViewModel.sources = sources;
   *
   * // Add to source(s)
   * searchViewModel.sources.push({ ... });  // new source
   */
  get sources(): Collection<SupportedSearchSource>;
  set sources(value: ReadonlyArrayOrCollection<(LocatorSearchSourceProperties | LayerSearchSourceProperties)>);
  /**
   * The current state. This property was removed from [Search](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html)
   * and should now be accessed within the [SearchViewModel](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html).
   *
   * @default "ready"
   * @since 4.8
   */
  get state(): SearchViewModelState;
  /**
   * The number of suggestions found for the search.
   *
   * @since 4.32
   */
  accessor suggestionCount: number | null | undefined;
  /**
   * The millisecond delay after keyup and before making a [suggest()](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#suggest) network request.
   *
   * @default 350
   */
  accessor suggestionDelay: number;
  /**
   * An array of results from the [suggest method](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#suggest).
   *
   * This is available if working with a 10.3 or greater geocoding service that has
   * [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a
   * 10.3 or greater feature layer that supports pagination, i.e. `supportsPagination = true`.
   */
  get suggestions(): SuggestResults[] | null | undefined;
  /**
   * Enable suggestions.
   *
   * This is only available if working with a 10.3 or greater geocoding service that has [suggest capability loaded]
   * (https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 or greater feature layer that supports pagination, i.e. `supportsPagination = true`.
   *
   * @default true
   */
  accessor suggestionsEnabled: boolean;
  /**
   * Indicates whether the `View` or `Portal` is loading resources prior to use.
   * If resources are still loading, this value is `false`.
   * If resources are done loading, this value is `true`.
   *
   * @default false
   * @since 4.16
   */
  get updating(): boolean;
  /** A reference to the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). Set this to link to a specific view. */
  accessor view: MapViewOrSceneView | null | undefined;
  /**
   * Clears the current value, search results, suggest results, graphic, and graphics layer.
   * It also hides any open menus.
   */
  clear(): void;
  /**
   * Depending on the sources specified, `search()` queries the feature layer(s) and/or performs
   * address matching using any specified [Locator(s)](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html) and
   * returns the applicable results.
   *
   * @param searchItem - This searchItem can be
   *        a string, point geometry, suggest candidate object, or an array containing [latitude,longitude].
   *        If a geometry is supplied, then it will reverse geocode (locator) or
   *        findAddressCandidates with geometry instead of text (featurelayer).
   * @param options - An object containing an optional `signal` property that can be used to cancel the request.
   * @returns When resolved, returns an object containing an array of [search results](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-types.html#SearchResult).
   */
  search(searchItem?: SearchItem | null | undefined, options?: AbortOptions): Promise<SearchResponse | null | undefined>;
  /**
   * Returns search results near your current location. It checks whether
   * [locationEnabled](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#locationEnabled) is `true`. If so, and your browser
   * supports [geolocation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation),
   * it will return search results nearby your current location.
   *
   * @param options - An object containing an optional `signal` property that can be used to cancel the request.
   * @returns When resolved, returns [SearchResponse](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-types.html#SearchResponse) containing an array of search objects.
   * Each of these objects contains a [SearchResult](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-types.html#SearchResult).
   */
  searchNearby(options?: AbortOptions): Promise<SearchResponse | null | undefined>;
  /**
   * Selects a result.
   *
   * @param value - The result object to select.
   * @returns When
   * resolved, returns [SearchResult](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-types.html#SearchResult).
   * @since 4.32
   */
  select(value: SearchResult | null | undefined): Promise<SearchResult>;
  /**
   * Performs a suggest() request on the active Locator. It uses the current value
   * or one that is passed in.
   *
   * Suggestions are available if working with a 10.3 or greater geocoding service that has
   * [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm)
   * or a 10.3 or greater feature layer that supports pagination, i.e.`supportsPagination = true`.
   *
   * @param suggestTerm - The string value used to suggest() on an active Locator or feature layer. If
   *                         nothing is passed in, takes the current value.
   * @param suggestionDelay - The millisecond delay after keyup and before making a `suggest()` network request.
   * @param options - An object containing an optional `signal` property that can be used to cancel the request.
   * @returns When resolved, returns [SuggestResponse](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-types.html#SuggestResponse) containing an array of result objects. Each of these results contains a [SuggestResult](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-types.html#SuggestResult).
   */
  suggest(suggestTerm?: string, suggestionDelay?: number | null | undefined, options?: AbortOptions): Promise<SuggestResponse | null | undefined>;
  /**
   * `when()` may be leveraged once the `SearchViewModel` has been updated.
   *
   * @returns A promise that resolves when `SearchViewModel` has been updated.
   * @since 4.16
   */
  when(): Promise<void>;
}
declare const SearchViewModelSuperclass: typeof EventedAccessor & typeof GoTo