import type AreaMeasurementAnalysis from "../../../analysis/AreaMeasurementAnalysis.js";
import type AnalysisView2D from "./AnalysisView2D.js";
import type SnappingOptions from "../../interactive/snapping/SnappingOptions.js";
import type { AbortOptions } from "../../../core/promiseUtils.js";
import type { SystemOrAreaUnit } from "../../../core/units.js";
import type { AreaMeasurementPlacementResult, AreaMeasurementResult } from "../../analysis/AreaMeasurement/types.js";
import type { SnappingOptionsProperties } from "../../interactive/snapping/SnappingOptions.js";

/**
 * Represents the analysis view of an [AreaMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-AreaMeasurementAnalysis.html)
 * after it has been added to [MapView.analyses](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#analyses).
 *
 * AreaMeasurementAnalysisView2D is responsible for the rendering, computing and interacting with
 * [AreaMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-AreaMeasurementAnalysis.html).
 * The [result](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-analysis-AreaMeasurementAnalysisView2D.html#result) property contains the computed area and perimeter as well as the analytical method.
 *
 * Use the [place()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-analysis-AreaMeasurementAnalysisView2D.html#place) method to initiate the interactive digitization of AreaMeasurementAnalysis geometry.
 *
 * To enable modification of an existing AreaMeasurementAnalysis geometry, set the [interactive](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-analysis-AreaMeasurementAnalysisView2D.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 conceptually 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 AreaMeasurementAnalysis();
 * view.analyses.add(analysis); // add to the view
 * const analysisView = await view.whenAnalysisView(analysis);
 * ```
 *
 * @since 5.0
 */
export default abstract class AreaMeasurementAnalysisView2D extends AnalysisView2D {
  /**
   * The area measurement analysis associated with the analysis view.
   *
   * @since 5.0
   */
  get analysis(): AreaMeasurementAnalysis;
  /**
   * Enables interactivity for the [analysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-analysis-AreaMeasurementAnalysisView2D.html#analysis). When set to `true` the input geometry can be edited interactively.
   *
   * @default false
   * @since 5.0
   */
  accessor interactive: boolean;
  /**
   * Result of the area measurement analysis. Result objects are created immediately but they are gradually updated as
   * the analysis is computed.
   *
   * @since 5.0
   */
  get result(): AreaMeasurementResult | 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.
   *
   * @since 5.0
   */
  get snappingOptions(): SnappingOptions;
  set snappingOptions(value: SnappingOptionsProperties);
  /**
   * The analysis view type.
   *
   * @since 5.0
   */
  get type(): "area-measurement-view-2d";
  /**
   * Unit system (imperial, metric) or specific unit used for displaying the computed area in the view. This value is
   * useful when [AreaMeasurementAnalysis.unit](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-AreaMeasurementAnalysis.html#unit) is not explicitly set on the
   * [analysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-analysis-AreaMeasurementAnalysisView2D.html#analysis).
   *
   * @since 5.0
   */
  get unit(): SystemOrAreaUnit;
  /**
   * This property is `true` when the analysis is recomputing or updating its visualization.
   *
   * @since 5.0
   */
  get updating(): boolean;
  /**
   * When `true`, the [analysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-analysis-AreaMeasurementAnalysisView2D.html#analysis) is visualized in the view.
   *
   * @since 5.0
   */
  accessor visible: boolean;
  /**
   * Starts an interactive placement operation to create a new [AreaMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-AreaMeasurementAnalysis.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 [AreaMeasurementAnalysis.geometry](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-AreaMeasurementAnalysis.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.
   * @since 5.0
   */
  place(options?: AbortOptions | null | undefined): Promise<AreaMeasurementPlacementResult>;
}