import type Graphic from "../../Graphic.js";
import type Collection from "../../core/Collection.js";
import type LayerView from "./LayerView.js";
import type { HighlightLayerViewMixin, HighlightLayerViewMixinProperties } from "./HighlightLayerViewMixin.js";
import type { LayerViewProperties } from "./LayerView.js";

export interface GraphicsLayerViewProperties extends HighlightLayerViewMixinProperties, LayerViewProperties {}

/**
 * Represents the [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) of a [GraphicsLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html)
 * after it has been added to a [Map](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html) in either a [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).
 *
 * The GraphicsLayerView is responsible for rendering a [GraphicsLayer's](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html)
 * features as [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) in the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html). The {@link views/layers/GraphicsLayerView#queryGraphics methods}
 * in the GraphicsLayerView provide developers with the ability to query graphics in the view. See the
 * code snippets in the {@link views/layers/GraphicsLayerView#queryGraphics methods} below for examples of how to access client-side graphics from the
 * view.
 *
 * @since 4.4
 * @see [GraphicsLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html)
 */
export default interface GraphicsLayerView extends HighlightLayerViewMixin, LayerView {
  /**
   * Returns all graphics available for drawing in the layer view
   * as a [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html).
   *
   * @returns When resolved, a [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of all [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) is returned.
   * @since 4.8
   * @example
   * let layer = new GraphicsLayer();
   *
   * // returns all the graphics from the layer view
   * const layerView = await view.whenLayerView(layer);
   * await reactiveUtils.whenOnce(() => !layerView.updating);
   * const results = await layerView.queryGraphics();
   * console.log(results);  // prints the array of client-side graphics to the console
   */
  queryGraphics(): Promise<Collection<Graphic>>;
}