import type ViewshedAnalysis from "../analysis/ViewshedAnalysis.js";
import type Extent from "../geometry/Extent.js";
import type SpatialReference from "../geometry/SpatialReference.js";
import type Layer from "./Layer.js";
import type { MultiOriginJSONSupportMixin } from "../core/MultiOriginJSONSupport.js";
import type { OperationalLayer, OperationalLayerProperties } from "./mixins/OperationalLayer.js";
import type { ViewshedAnalysisProperties } from "../analysis/ViewshedAnalysis.js";
import type { LayerProperties } from "./Layer.js";

export interface ViewshedLayerProperties extends LayerProperties, OperationalLayerProperties {
  /**
   * The [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/) associated with the layer that stores the viewsheds.
   * Assigning a null value will create a new empty analysis.
   */
  source?: ViewshedAnalysisProperties;
  /**
   * The title of the layer used to identify it in places such as the [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/) widget
   * or [Layer List](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-layer-list/) component.
   *
   * If a layer is loaded as part of a webscene, then the title of the layer as stored in the webscene will be used.
   */
  title?: string | null;
}

/**
 * The viewshed layer enables the creation and display of viewshed and view dome type of visibility analysis in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
 *
 * It can be grouped with other layers, and when a [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/) widget
 * or [Layer List](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-layer-list/) component is used,
 * the viewshed layer appears in the list. It can be persisted in a [WebScene](https://developers.arcgis.com/javascript/latest/references/core/WebScene/).
 *
 * The viewsheds can be created interactively or added programmatically to a [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/)
 * object, which is then set as the layer's [source](https://developers.arcgis.com/javascript/latest/references/core/layers/ViewshedLayer/#source).
 *
 * ```js
 * // create analysis with viewshed
 * const viewshedAnalysis = new ViewshedAnalysis({
 *    viewsheds: [
 *      new Viewshed({
 *        observer: new Point({ }),
 *        farDistance: 900,
 *        heading: 64,
 *        tilt: 84,
 *        horizontalFieldOfView: 85,
 *        verticalFieldOfView: 52
 *      })
 *    ]
 * });
 *
 * // add analysis to the layer
 * const viewshedLayer = new ViewshedLayer({
 *    source: viewshedAnalysis,
 * });
 *
 * // add layer to the map
 * view.map.add(viewshedLayer);
 * ```
 *
 * To start creating or editing viewsheds interactively, use the
 * [ViewshedLayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/ViewshedLayerView/).
 *
 * ```js
 * // retrieve layer view for the layer
 * const viewshedLayerView = await view.whenLayerView(viewshedLayer);
 *
 * // allow existing viewsheds in the layer to be selected and edited
 * // select a viewshed by hovering and clicking on their field-of-view manipulators
 * viewshedLayerView.interactive = true;
 *
 * // start placing new viewsheds interactively
 * const abortController = new AbortController();
 *
 * try {
 *   await viewshedLayerView.place({ signal: abortController.signal });
 * } catch (error) {
 *   if (error.name === "AbortError") {
 *     console.log("Placement operation was cancelled.");
 *   }
 * }
 *
 * // cancel the placement operation at some later point
 * abortController.abort();
 * ```
 *
 * > [!WARNING]
 * >
 * > **Known Limitations**
 * >
 * > This layer is only supported in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
 * > The results of the tool vary depending on the zoom level, as changes in zoom level affect the level of detail (LOD) of the scene geometry.
 *
 * @since 4.31
 * @see [ViewshedLayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/ViewshedLayerView/)
 * @see [Viewshed](https://developers.arcgis.com/javascript/latest/references/core/analysis/Viewshed/)
 * @see [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/)
 * @see [ViewshedAnalysisView3D](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/)
 * @see [Sample - ViewshedLayer in slides](https://developers.arcgis.com/javascript/latest/sample-code/layers-viewshed/)
 */
export default class ViewshedLayer extends ViewshedLayerSuperclass {
  /** @example const viewshedLayer = new ViewshedLayer(); */
  constructor(properties?: ViewshedLayerProperties);
  /**
   * The full extent of the layer which contains all viewsheds referenced by the layer.
   *
   * @example
   * // Once the layer loads, set the view's extent to the layer's full extent
   * layer.when(function(){
   *   view.extent = layer.fullExtent;
   * });
   */
  get fullExtent(): Extent | null | undefined;
  /**
   * The [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/) associated with the layer that stores the viewsheds.
   * Assigning a null value will create a new empty analysis.
   */
  get source(): ViewshedAnalysis;
  set source(value: ViewshedAnalysisProperties);
  /** The spatial reference of the layer. The spatial reference is derived from the [source](https://developers.arcgis.com/javascript/latest/references/core/layers/ViewshedLayer/#source). */
  get spatialReference(): SpatialReference;
  /**
   * The title of the layer used to identify it in places such as the [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/) widget
   * or [Layer List](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-layer-list/) component.
   *
   * If a layer is loaded as part of a webscene, then the title of the layer as stored in the webscene will be used.
   */
  accessor title: string | null | undefined;
  /** The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. */
  get type(): "viewshed";
}
declare const ViewshedLayerSuperclass: typeof Layer & typeof MultiOriginJSONSupportMixin & typeof OperationalLayer