import type Graphic from "../../Graphic.js";
import type Collection from "../../core/Collection.js";
import type LayerView from "./LayerView.js";
import type HighlightOptions from "../support/HighlightOptions.js";
import type { ResourceHandle } from "../../core/Handles.js";
import type { ObjectId } from "../types.js";
import type { LayerViewProperties } from "./LayerView.js";
import type { LayerViewHighlightOptions } from "./types.js";
import type { HighlightOptionsProperties } from "../support/HighlightOptions.js";

export interface GraphicsLayerViewProperties extends 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](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-GraphicsLayerView.html) 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 interface provides the
 * `queryGraphics()` method so developers can query graphics in the view. See the method documentation 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 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>>;
  /**
   * Options for configuring the highlight. Use the [FeatureLikeLayerView.highlight()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLikeLayerView.html#highlight) method on the layer view to highlight a feature
   *
   * > [!WARNING]
   * >
   * > **Known Limitations**
   * >
   * > The `highlightOptions` on layer views are only supported in [2D MapViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html). To
   * > configure highlights for a [3D SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html), use
   * > [SceneView.highlights](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlights) instead.
   *
   * @deprecated since version 4.34. Use the [View.highlights](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#highlights) property instead.
   * @since 4.26
   * @see [FeatureLikeLayerView.highlight()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLikeLayerView.html#highlight)
   * @see [Sample: Highlight SceneLayer](https://developers.arcgis.com/javascript/latest/sample-code/highlight-scenelayer/)
   * @example
   * // Features in the layerview will be highlighted with bright
   * // yellow colors in the map.
   * const layerView = await view.whenLayerView(layer);
   * layerView.highlightOptions = {
   *   color: [255, 255, 0, 1],
   *   haloOpacity: 0.9,
   *   fillOpacity: 0.2
   * };
   */
  get highlightOptions(): HighlightOptions | null | undefined;
  set highlightOptions(value: HighlightOptionsProperties | null | undefined);
  /**
   * Highlights the given feature(s) in a layer view using the named [HighlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-support-HighlightOptions.html)
   * from the view's [View.highlights](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#highlights) collection. If no `name` is provided, the
   * feature will use the `default` highlight options.
   *
   * Release-specific changes:
   * * As of version 4.32, the `highlight` method accepts an `options` parameter which can be used to provide a [HighlightOptions.name](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-support-HighlightOptions.html#name)
   * to apply specific [HighlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-support-HighlightOptions.html).
   * If no `name` is provided, the `default` highlight options will be used.
   * * As of version 4.23, the `highlight()` method was added to [ImageryLayerView.highlight()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-ImageryLayerView.html#highlight),
   *   supported only in a [2D MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html).
   *
   * @param target - The feature(s) to highlight. When passing a graphic or an array of graphics, each feature must have a valid `objectID`.\nYou may alternatively pass one or more objectIDs as a single number, string, or an array of numbers or strings.
   * @param options - An object with the following properties.
   * @public
   * @param target - The feature(s) to highlight. When passing a graphic or an array of graphics, each feature must have a valid `objectID`.
   * You may alternatively pass one or more objectIDs as a single number, string, or an array of numbers or strings.
   * @param options - An object with the following properties.
   * @returns Returns a highlight handler with a `remove()` method that can be called to remove the highlight.
   * @see [View.highlights](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#highlights)
   * @see [Sample: Highlight features by geometry](https://developers.arcgis.com/javascript/latest/sample-code/highlight-features-by-geometry/)
   * @see [Sample: Highlight SceneLayer](https://developers.arcgis.com/javascript/latest/sample-code/highlight-scenelayer/)
   * @example
   * // Highlight features based on a query result
   *
   * // Add a new set of highlight options to the view's highlights collection
   * view.highlights.push({
   *   name: "oaks",
   *   color: "forestgreen",
   *   haloOpacity: 0.8,
   *   fillOpacity: 0.3
   * });
   *
   * // A handler can be used to remove any previous highlight when applying a new one
   * let highlight;
   *
   * // Query for particular features in a layer and then highlight them with the specified options
   * view.whenLayerView(treesLayer).then((layerView) => {
   *   let query = treesLayer.createQuery();
   *   query.where = "type = 'Quercus'";
   *
   *   treesLayer.queryFeatures(query).then((result) => {
   *     // Remove any previous highlight, if it exists
   *     highlight?.remove();
   *     // Apply the "oaks" highlight options to the corresponding tree features
   *     highlight = layerView.highlight(result.features, {name: "oaks"});
   *   });
   * });
   * @example
   * // Use the default highlights collection to apply a highlight to features when you hover over them
   *
   * // A handler can be used to remove any previous highlight when applying a new one
   * let hoverHighlight;
   *
   * view.on("pointer-move", (event) => {
   *   // Search for the first feature in the featureLayer at the hovered location
   *   view.hitTest(event, { include: layer }).then((response) => {
   *     if (response.results[0]) {
   *       const graphic = response.results[0].graphic;
   *       view.whenLayerView(graphic.layer).then((layerView) => {
   *         // Remove any previous highlight, if it exists
   *         hoverHighlight?.remove();
   *         // Highlight the hit features with the temporary highlight options, which are pre-configured for this use case
   *         hoverHighlight = layerView.highlight(graphic, { name: "temporary" });
   *       });
   *     }
   *   });
   * });
   */
  highlight(target: Graphic | Graphic[] | ObjectId | ObjectId[], options?: LayerViewHighlightOptions): ResourceHandle;
}