import type Graphic from "../../Graphic.js";
import type Accessor from "../../core/Accessor.js";
import type EditorViewModel from "./EditorViewModel.js";
import type Edits from "./Edits.js";
import type EditorItem from "./support/EditorItem.js";
import type { SplitterGeometry } from "./types.js";

export interface SplitFeatureWorkflowDataProperties extends Partial<Pick<SplitFeatureWorkflowData, "existingFeatureEdits" | "feature" | "newFeatureEdits" | "splitterGeometry" | "viewModel">> {
  /**
   * The `EditorItem` object from `EditorViewModel` corresponding to the
   *  layer being updated.
   */
  editorItem?: EditorItem;
}

/**
 * This object contains data for the [SplitFeatureWorkflow](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflow.html).
 * This is accessed via the property
 * [SplitFeatureWorkflow.data](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflow.html#data).
 *
 * @since 4.34
 * @see [Editor](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor.html)
 * @see [EditorViewModel](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-EditorViewModel.html)
 * @see [Workflow](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-Workflow.html)
 * @see [SplitFeatureWorkflow](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflow.html)
 */
export default class SplitFeatureWorkflowData extends Accessor {
  constructor(properties: SplitFeatureWorkflowDataProperties);
  /**
   * The `EditorItem` object from `EditorViewModel` corresponding to the
   *  layer being updated.
   */
  get editorItem(): EditorItem;
  /**
   * Information about the feature to be updated as a result of the split operation.
   *
   * A split workflow results in two edits: the existing feature is updated to
   * have one of the geometries resulting from the split, and a new feature is
   * created with the other geometry. This property references the feature that
   * will be updated.
   *
   * @see [newFeatureEdits](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflowData.html#newFeatureEdits)
   */
  accessor existingFeatureEdits: Edits | null | undefined;
  /**
   * The feature to be split.
   *
   * This feature's [Graphic.attributes](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#attributes) object
   * must contain all fields for which values are set on the feature, and its
   * [Graphic.geometry](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#geometry) must be full resolution. If
   * the [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) was obtained from a layer view
   * query, it is likely that the geometry is not full resolution and that the
   * attributes do not contain all fields.
   */
  accessor feature: Graphic;
  /**
   * Information about the feature to be created as a result of the split operation.
   *
   * @see [newFeatureEdits](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflowData.html#newFeatureEdits)
   */
  accessor newFeatureEdits: Edits | null | undefined;
  /** The geometry to be used to split the geometry of the initial feature. */
  accessor splitterGeometry: SplitterGeometry | null | undefined;
  /** The associated [EditorViewModel](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-EditorViewModel.html) for this workflow. */
  accessor viewModel: EditorViewModel;
  /**
   * Returns the instance of `Edits` corresponding to the given feature. Returns
   * the value of either [existingFeatureEdits](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflowData.html#existingFeatureEdits) or
   * [newFeatureEdits](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflowData.html#newFeatureEdits), depending on which feature is
   * passed. If `feature` is not one of the two
   * [Graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) generated by the workflow, this method
   * returns `null`.
   *
   * The primary way of accessing the Graphics generated by the workflow is
   * through the [Edits.feature](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-Edits.html#feature)
   * property of the [Edits](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-Edits.html) objects
   * referenced by [existingFeatureEdits](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflowData.html#existingFeatureEdits) and
   * [newFeatureEdits](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-SplitFeatureWorkflowData.html#newFeatureEdits). This method is useful if you obtain
   * one of the Graphics outside of this context and need to access the Edits
   * object it belongs to.
   *
   * @param feature - Either of the two [Graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) created by the workflow.
   */
  getEditsForFeature(feature: Graphic): Edits | null;
  /**
   * Identifies whether the given [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) represents
   * the feature to be updated or the feature to be created.
   *
   * @param feature - Either of the two [Graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) created by the workflow.
   * @returns The role of the feature in the split
   * operation, or `null` if the feature does not belong to this workflow.
   */
  getRoleForFeature(feature: Graphic): "existing" | "new" | null;
}