import type SliceAnalysis from "../../analysis/SliceAnalysis.js";
import type SlicePlane from "../../analysis/SlicePlane.js";
import type Accessor from "../../core/Accessor.js";
import type Collection from "../../core/Collection.js";
import type SceneView from "../../views/SceneView.js";
import type { SlicePlaneProperties } from "../../analysis/SlicePlane.js";
import type { SliceableLayer } from "../../analysis/Slice/types.js";
import type { ReadonlyArrayOrCollection } from "../../core/Collection.js";
import type { SliceAnalysisProperties } from "../../analysis/SliceAnalysis.js";

/** @deprecated since version 4.33. Use the [SliceAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/SliceAnalysis/) or [Slice component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slice/) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/). */
export interface SliceViewModelProperties extends Partial<Pick<SliceViewModel, "excludeGroundSurface" | "tiltEnabled" | "view">> {
  /**
   * The slice analysis object being created or modified by the view model.
   *
   * If no analysis is provided, the view model automatically creates its own analysis and adds it to the view. In
   * this case, the analysis will also be automatically removed from the view when the view model is destroyed.
   *
   * @since 4.23
   * @example
   * // Construct a slice analysis object outside of the view model
   * const sliceAnalysis = new SliceAnalysis({
   *   shape: {
   *     type: "plane", // autocasts as new SlicePlane()
   *     position: {
   *       type: "point",
   *       x: -0.1,
   *       y: 51.5
   *     },
   *     width: 50,
   *     height: 50,
   *     tilt: 45
   *   },
   *   tiltEnabled: true
   * });
   *
   * // Ensure that the analysis is added to the view
   * view.analyses.add(sliceAnalysis);
   *
   * // Frame the analysis in the view
   * view.goTo(sliceAnalysis.extent);
   *
   * // Pass the analysis object as a constructor parameter to modify it using the view model
   * const sliceViewModel = new SliceViewModel({
   *   analysis: sliceAnalysis,
   *   view: view
   * });
   */
  analysis?: SliceAnalysisProperties;
  /**
   * Add layers to this collection to exclude them from the slice. Layers that
   * are draped on the ground surface are not affected by this property
   */
  excludedLayers?: ReadonlyArrayOrCollection<SliceableLayer>;
  /**
   * The shape used to slice elements in a 3D scene.
   * Currently the only supported shape is a plane.
   *
   * @since 4.16
   * @example
   * // Clone the shape to modify its properties
   * const shape = sliceViewModel.shape.clone();
   *
   * // Set new values for heading and tilt
   * shape.heading = 180;
   * shape.tilt = 45;
   *
   * // Set the new properties on the slice view model's shape
   * sliceViewModel.shape = shape;
   */
  shape?: (SlicePlaneProperties & { type: "plane"; }) | null;
}

/**
 * Provides the logic for the [Slice](https://developers.arcgis.com/javascript/latest/references/core/widgets/Slice/) widget and [component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slice/).
 * SliceViewModel provides access to the [slice plane](https://developers.arcgis.com/javascript/latest/references/core/widgets/Slice/SliceViewModel/#shape) and the
 * [layers](https://developers.arcgis.com/javascript/latest/references/core/widgets/Slice/SliceViewModel/#excludedLayers) that can be excluded from the slice widget.
 *
 * @deprecated since version 4.33. Use the [SliceAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/SliceAnalysis/) or [Slice component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slice/) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
 * @since 4.10
 * @see [Slice](https://developers.arcgis.com/javascript/latest/references/core/widgets/Slice/) widget - _Deprecated since 4.33. Use the [Slice component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slice/) instead._
 * @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern)
 */
export default class SliceViewModel extends Accessor {
  constructor(properties?: SliceViewModelProperties);
  /**
   * The slice analysis object being created or modified by the view model.
   *
   * If no analysis is provided, the view model automatically creates its own analysis and adds it to the view. In
   * this case, the analysis will also be automatically removed from the view when the view model is destroyed.
   *
   * @since 4.23
   * @example
   * // Construct a slice analysis object outside of the view model
   * const sliceAnalysis = new SliceAnalysis({
   *   shape: {
   *     type: "plane", // autocasts as new SlicePlane()
   *     position: {
   *       type: "point",
   *       x: -0.1,
   *       y: 51.5
   *     },
   *     width: 50,
   *     height: 50,
   *     tilt: 45
   *   },
   *   tiltEnabled: true
   * });
   *
   * // Ensure that the analysis is added to the view
   * view.analyses.add(sliceAnalysis);
   *
   * // Frame the analysis in the view
   * view.goTo(sliceAnalysis.extent);
   *
   * // Pass the analysis object as a constructor parameter to modify it using the view model
   * const sliceViewModel = new SliceViewModel({
   *   analysis: sliceAnalysis,
   *   view: view
   * });
   */
  get analysis(): SliceAnalysis;
  set analysis(value: SliceAnalysisProperties);
  /**
   * Add layers to this collection to exclude them from the slice. Layers that
   * are draped on the ground surface are not affected by this property
   */
  get excludedLayers(): Collection<SliceableLayer>;
  set excludedLayers(value: ReadonlyArrayOrCollection<SliceableLayer>);
  /**
   * Indicates whether the [Ground](https://developers.arcgis.com/javascript/latest/references/core/Ground/) and layers that
   * are draped on the ground surface are excluded from the slice.
   *
   * @default false
   */
  accessor excludeGroundSurface: boolean;
  /**
   * The shape used to slice elements in a 3D scene.
   * Currently the only supported shape is a plane.
   *
   * @since 4.16
   * @example
   * // Clone the shape to modify its properties
   * const shape = sliceViewModel.shape.clone();
   *
   * // Set new values for heading and tilt
   * shape.heading = 180;
   * shape.tilt = 45;
   *
   * // Set the new properties on the slice view model's shape
   * sliceViewModel.shape = shape;
   */
  get shape(): SlicePlane | null | undefined;
  set shape(value: (SlicePlaneProperties & { type: "plane"; }) | null | undefined);
  /**
   * The view model's state.
   *
   * Value | Description
   * ------------|-------------
   * disabled | not ready yet
   * ready | ready for slicing
   * slicing | currently slicing
   * sliced | finished slicing
   *
   * @default "disabled"
   */
  get state(): "disabled" | "ready" | "slicing" | "sliced";
  /**
   * Enable tilting the slice shape. If set to true, the slice shape will orient itself as best as
   * possible to the surface under the cursor when first placing the shape. If set to false, the slice shape is
   * restricted to be either horizontal or vertical.
   *
   * @default false
   * @since 4.16
   */
  accessor tiltEnabled: boolean;
  /** The view from which the widget will operate. */
  view?: SceneView | null;
  /**
   * Clears the [shape](https://developers.arcgis.com/javascript/latest/references/core/widgets/Slice/SliceViewModel/#shape) of the slice, effectively removing it from the view.
   * Other properties like [excludedLayers](https://developers.arcgis.com/javascript/latest/references/core/widgets/Slice/SliceViewModel/#excludedLayers) and [excludeGroundSurface](https://developers.arcgis.com/javascript/latest/references/core/widgets/Slice/SliceViewModel/#excludeGroundSurface)
   * are not modified.
   *
   * @since 4.16
   */
  clear(): void;
  /**
   * Starts the interactive creation of a new slice, clearing the previous [shape](https://developers.arcgis.com/javascript/latest/references/core/widgets/Slice/SliceViewModel/#shape).
   *
   * @since 4.16
   */
  start(): Promise<void>;
}