import type LengthDimension from "../../analysis/LengthDimension.js";
import type DimensionLayer from "../../layers/DimensionLayer.js";
import type LengthDimensionResult from "../analysis/LengthDimensionResult.js";
import type { ReadonlyCollection } from "../../core/Collection.js";
import type { AbortOptions } from "../../core/promiseUtils.js";
import type { DimensionPlacementResult } from "../3d/analysis/Dimension/types.js";

export interface DimensionLayerViewMixinProperties extends Partial<Pick<DimensionLayerViewMixin, "interactive" | "selectedDimension">> {}

export abstract class DimensionLayerViewMixin {
  constructor(...args: any[]);
  /**
   * Enables interactivity for the [layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-DimensionLayerViewMixin.html#layer). When set to `true` and the layer's
   * [DimensionLayer#source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-DimensionLayer.html#source) includes any
   * valid [DimensionAnalysis#dimensions](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-DimensionAnalysis.html#dimensions), they become selectable and editable.
   *
   * @default false
   */
  accessor interactive: boolean;
  /** The layer being viewed. */
  get layer(): DimensionLayer;
  /**
   * Results for each dimension in the layer [DimensionLayer#source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-DimensionLayer.html#source).
   *
   * Given a [dimension](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-LengthDimension.html) object, the results collection can be searched:
   *
   * ```js
   * const result = dimensionLayerView.results.find((result) => result.dimension === dimensionObject);
   * ```
   */
  get results(): ReadonlyCollection<LengthDimensionResult>;
  /**
   * The selected dimension. If [interactive](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-DimensionLayerViewMixin.html#interactive) is `true`, any dimension in the
   * [layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-DimensionLayerViewMixin.html#layer) can be selected by clicking on it in the view. As long as [interactive](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-DimensionLayerViewMixin.html#interactive)
   * remains `true`, the properties of the selected dimension can be edited by interacting with
   * manipulators in the view.
   */
  accessor selectedDimension: LengthDimension | null | undefined;
  /**
   * Starts the interactive creation of new dimensions and adds them to the [layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-DimensionLayerViewMixin.html#layer)'s
   * [DimensionLayer#source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-DimensionLayer.html#source).
   *
   * The creation process will finish when the user double-clicks the mouse or presses the escape key.
   * To stop the creation programmatically, pass an abort signal as an argument when calling the method.
   *
   * This method is similar to the [place()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-DimensionLayerViewMixin.html#place) method, but it allows to create multiple dimensions in a row.
   *
   * Calling this method sets [interactive](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-DimensionLayerViewMixin.html#interactive) to `true`.
   *
   * @param options - An object specifying additional options.
   * @returns A promise which resolves when creation is completed successfully or rejected if it is
   * canceled.
   * @example
   * const abortController = new AbortController();
   *
   * try {
   *   await layerView.createLengthDimensions({ signal: abortController.signal });
   * } catch (error) {
   *   if (error.name === "AbortError") {
   *     console.log("Creation operation was cancelled.");
   *   }
   * }
   *
   * // cancel the placement operation at some later point
   * abortController.abort();
   */
  createLengthDimensions(options?: AbortOptions | null | undefined): Promise<void>;
  /**
   * Starts the interactive placement of a single dimension, adding it to the [layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-DimensionLayerViewMixin.html#layer)'s
   * [DimensionLayer#source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-DimensionLayer.html#source).
   *
   * The first click places start point and the second sets end point.
   *
   * The placement operation will finish when the user presses the escape key.
   * To stop the placing programmatically, pass an abort signal as an argument when calling the method.
   *
   * Calling this method sets [interactive](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-DimensionLayerViewMixin.html#interactive) to `true`.
   *
   * @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 4.33
   * @example
   * const abortController = new AbortController();
   *
   * try {
   *   await layerView.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();
   */
  place(options?: AbortOptions | null | undefined): Promise<DimensionPlacementResult>;
}