import type Graphic from "../../Graphic.js";
import type SplitFeatureWorkflowData from "./SplitFeatureWorkflowData.js";
import type Workflow from "./Workflow.js";
import type FeatureFormViewModel from "../FeatureForm/FeatureFormViewModel.js";
import type { EditorLayerUnion, SplitFeatureWorkflowStep, SplitterGeometryType } from "./types.js";
import type { WorkflowProperties } from "./Workflow.js";

export interface SplitFeatureWorkflowProperties extends WorkflowProperties, Partial<Pick<SplitFeatureWorkflow, "defaultSplitterGeometryType">> {}

/**
 * A read-only class containing the logic used when splitting a selected feature using
 * the [Editor](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor.html) widget. The workflow has two steps. In the first step, the user sketches the geometry that will be used to split the feature. In the next step, the user can review the two resulting features and their attributes.
 *
 * > [!WARNING]
 * >
 * > Currently only supported in 2D.
 * > Support is limited to splitting one feature at a time.
 * > Point features cannot be split.
 * > When using a polyline splitter geometry, all parts of a multipart feature must be split together. To split only specific parts of a multipart feature, use a polygon splitter geometry instead.
 *
 * @since 4.34
 * @see [Editor](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor.html)
 * @see [Workflow](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-Workflow.html)
 * @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern)
 */
export default class SplitFeatureWorkflow extends Workflow<SplitFeatureWorkflowData, SplitFeatureWorkflowStep> {
  constructor(properties?: SplitFeatureWorkflowProperties);
  /**
   * The currently active feature. The active feature is highlighted in the
   * view, and is assigned to the workflow's
   * [featureFormViewModel](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflow.html#formViewModel), so that the form shows and manages
   * its attribute values.
   */
  get activeFeature(): Graphic | null | undefined;
  /**
   * Specifies the type of geometry to be drawn by the Sketch operation that is
   * started automatically when the workflow is launched. The user has the
   * option to begin a different Sketch operation with a different geometry
   * type.
   */
  accessor defaultSplitterGeometryType: SplitterGeometryType | null | undefined;
  /**
   * The instance of
   * [FeatureFormViewModel](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html) used by the
   * workflow to manage the attributes of the resulting features.
   */
  get formViewModel(): FeatureFormViewModel;
  /**
   * The layer to which the feature being split belongs. This is also the layer
   * to which the
   * [new feature](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflowData.html#newFeatureEdits)
   * created by the workflow will be added.
   */
  get layer(): EditorLayerUnion;
  /**
   * The type of the workflow.
   *
   * @default "split-feature"
   */
  get type(): "split-feature";
  /**
   * Sets the specified feature as the active feature in the workflow. Setting a
   * feature as active causes it to become highlighted and to be assigned to the
   * [form view model](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-EditorViewModel.html#featureFormViewModel).
   *
   * The feature must be one of the two features resulting from the split
   * operation — i.e., the instance of {module:esri/Graphic} associated with
   * either the {@link widgets/Editor/SplitFeatureWorkflow#existingFeatureEdits} or
   * {@link widgets/Editor/SplitFeatureWorkflow#newFeatureEdits} property of the workflow's
   * [data](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflow.html#data).
   *
   * @param feature - The feature to set as active.
   * @returns A promise that resolves when the feature has been set as active.
   */
  setActiveFeature(feature: Graphic | null | undefined): Promise<void>;
}