import type Collection from "../../core/Collection.js";
import type BuildingSceneLayer from "../../layers/BuildingSceneLayer.js";
import type BuildingComponentSublayerView from "./BuildingComponentSublayerView.js";
import type LayerView from "./LayerView.js";
import type { ResourceHandle } from "../../core/Handles.js";
import type { HighlightTarget } from "../types.js";
import type { LayerViewHighlightOptions } from "./types.js";
import type { LayerViewProperties } from "./LayerView.js";

export interface BuildingSceneLayerViewProperties extends LayerViewProperties {}

/**
 * Represents the [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) of a [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html)
 * after it has been added to a [Map](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html) in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
 * BuildingSceneLayerView is responsible for streaming and rendering a [BuildingSceneLayer's](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html)
 * features in the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
 *
 * The BuildingSceneLayerView contains a list of [sublayer views](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-BuildingComponentSublayerView.html)
 * for all the [component sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-buildingSublayers-BuildingComponentSublayer.html) of a
 * [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html). The BuildingSceneLayerView doesn't have query methods. To query the features
 * loaded on the client, use the [query methods](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-BuildingComponentSublayerView.html#methods-summary)
 * on the component [sublayer views](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-BuildingComponentSublayerView.html):
 *
 * ```js
 * // query all the loaded features
 * view.whenLayerView(buildingSceneLayer).then(function(buildingSceneLayerView) {
 *    buildingSceneLayerView.sublayerViews.forEach(function(sublayerView) {
 *        const query = sublayerView.createQuery();
 *        sublayerView.queryFeatures(query).then(function(result) {
 *          console.log(result.features);
 *        });
 *    });
 * });
 * ```
 *
 * The BuildingSceneLayerView can be used to highlight features in any of the
 * [component sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-buildingSublayers-BuildingComponentSublayer.html). The [highlight method](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-BuildingSceneLayerView.html#highlight)
 * takes as arguments the features that should be highlighted:
 *
 * ```js
 * // on user click, select the first feature in the BuildingSceneLayer
 * let highlight = null;
 *
 * view.on("click", function (event) {
 *   view.hitTest(event.screenPoint, {include: buildingSceneLayer}).then((hitTestResult) => {
 *     if (highlight) {
 *       highlight.remove();
 *       highlight = null;
 *     }
 *     if (hitTestResult.results.length) {
 *       highlight = bslv.highlight(hitTestResult.results[0].graphic);
 *     }
 *   });
 * });
 * ```
 *
 * @since 4.17
 * @see [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html)
 */
export default class BuildingSceneLayerView extends LayerView {
  constructor(properties?: BuildingSceneLayerViewProperties);
  /** The layer being viewed. */
  get layer(): BuildingSceneLayer;
  /**
   * Collection of [sublayer views](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-BuildingComponentSublayerView.html) for all the
   * component sublayers of the BuildingSceneLayer.
   *
   * @example
   * view.whenLayerView(buildingSceneLayer).then(function(buildingSceneLayerView) {
   *    console.log(buildingSceneLayerView.sublayerViews);
   * });
   */
  get sublayerViews(): Collection<BuildingComponentSublayerView>;
  /**
   * Highlights the given feature(s).
   *
   * @param target - The feature(s) to highlight. The graphics that are passed to this function must originate from one
   *   of the component sublayers of the BuildigSceneLayer.
   * @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.
   * @example
   * // On user click, highlight the first feature selected in the BuildingSceneLayer
   *
   * // Add a new set of highlight options to the view's highlights collection
   * view.highlights.push({name: "selection", color: "red"});
   *
   * // A handler can be used to remove any previous highlight when applying a new one
   * let highlight;
   *
   * view.on("click", function (event) {
   *   // Idenitfy the first feature in the BuildingSceneLayer at the clicked location
   *   view.hitTest(event.screenPoint, {include: buildingSceneLayer}).then((hitTestResult) => {
   *     if (hitTestResult.results[0]) {
   *       const graphic = hitTestResult.results[0].graphic;
   *       view.whenLayerView(graphic.layer).then((layerView) => {
   *         // Remove any previous highlight, if it exists
   *         highlight?.remove();
   *         // Highlight the selected feature with the specified highlight options
   *         highlight = layerView.highlight(graphic, { name: "selection" } );
   *       });
   *     }
   *   });
   * });
   */
  highlight(target: HighlightTarget, options?: LayerViewHighlightOptions): ResourceHandle;
}