import type DistanceMeasurementAnalysis from "../../../analysis/DistanceMeasurementAnalysis.js";
import type AnalysisView2D from "./AnalysisView2D.js";
import type SnappingOptions from "../../interactive/snapping/SnappingOptions.js";
import type { AbortOptions } from "../../../core/promiseUtils.js";
import type { SystemOrLengthUnit } from "../../../core/units.js";
import type { DistanceMeasurementPlacementResult, DistanceMeasurementResult } from "../../analysis/DistanceMeasurement/types.js";
import type { SnappingOptionsProperties } from "../../interactive/snapping/SnappingOptions.js";

/**
 * Represents the analysis view of an [DistanceMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-DistanceMeasurementAnalysis.html)
 * after it has been added to [MapView#analyses](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#analyses).
 *
 * DistanceMeasurementAnalysisView2D is responsible for the rendering, computing and interacting with
 * [DistanceMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-DistanceMeasurementAnalysis.html).
 * The [result](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-analysis-DistanceMeasurementAnalysisView2D.html#result) property contains the computed distance as well as the analytical method.
 *
 * Use the [place()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-analysis-DistanceMeasurementAnalysisView2D.html#place) method to initiate the interactive ditization of DistanceMeasurementAnalysis geometry.
 *
 * To enable modification of an existing DistanceMeasurementAnalysis geometry, set the [interactive](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-analysis-DistanceMeasurementAnalysisView2D.html#interactive) property to `true`.
 *
 * Use [MapView#whenAnalysisView()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#whenAnalysisView) to obtain the analysis view of an existing analysis.
 * This is concepturally similar to how layer views are retrieved for layers using [MapView#whenLayerView()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#whenLayerView).
 *
 * ```js
 * // Retrieve analysis view for analysis
 * const analysis = new DistanceMeasurementAnalysis();
 * view.analyses.add(analysis); // add to the view
 * const analysisView = await view.whenAnalysisView(analysis);
 * ```
 *
 * @since 5.0
 */
export default abstract class DistanceMeasurementAnalysisView2D extends AnalysisView2D {
  /** The distance measurement analysis associated with the analysis view. */
  get analysis(): DistanceMeasurementAnalysis;
  /**
   * Enables interactivity for the [analysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-analysis-DistanceMeasurementAnalysisView2D.html#analysis). When set to `true` the input geometry can be edited interactively.
   *
   * @default false
   */
  accessor interactive: boolean;
  /**
   * Result of the elevation profile analysis. Result objects are created immediately but they are gradually updated as
   * the analysis is computed.
   */
  get result(): DistanceMeasurementResult | null | undefined;
  /**
   * The [SnappingOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html) for sketching.
   * It supports [self](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html#selfEnabled) and
   * [feature](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html#featureEnabled) snapping.
   */
  get snappingOptions(): SnappingOptions;
  set snappingOptions(value: SnappingOptionsProperties);
  /** The analysis view type. */
  get type(): "distance-measurement-view-2d";
  /**
   * Unit system (imperial, metric) or specific unit used for displaying the computed length in the view.
   * Use this property when the [DistanceMeasurementAnalysis#unit](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-DistanceMeasurementAnalysis.html#unit) was not explicitly set on the [analysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-analysis-DistanceMeasurementAnalysisView2D.html#analysis).
   */
  get unit(): SystemOrLengthUnit;
  /** This property is `true` when the analysis is recomputing or updating its visualization. */
  get updating(): boolean;
  /** When `true`, the [analysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-analysis-DistanceMeasurementAnalysisView2D.html#analysis) is visualized in the view. */
  accessor visible: boolean;
  /**
   * Starts an interactive placement operation to create a new [DistanceMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-DistanceMeasurementAnalysis.html).
   *
   * The placement operation will finish when the user presses the escape key, double taps, or double clicks.
   * To stop the placing programmatically, pass an abort signal as an argument when calling the method.
   *
   * When placement operation completes successfully, the analysis will have a valid [DistanceMeasurementAnalysis#geometry](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-DistanceMeasurementAnalysis.html#geometry).
   *
   * @param options - An object specifying additional options.
   * @returns A promise which resolves when the operation is completed successfully or rejected if it is canceled.
   */
  place(options?: AbortOptions | null | undefined): Promise<DistanceMeasurementPlacementResult>;
}