import type Graphic from "../../Graphic.js";
import type EditorViewModel from "./EditorViewModel.js";
import type EditorItem from "./support/EditorItem.js";
import type { EsriPromise } from "../../core/Promise.js";
import type { FeatureInfo } from "./types.js";

export interface UpdateFeaturesWorkflowDataProperties extends Partial<Pick<UpdateFeaturesWorkflowData, "selectedFeature" | "viewModel">> {
  /**
   * The `EditorItem` objects from `EditorViewModel` corresponding to the
   *  layers/tables being updated.
   *
   * This array should be treated as read-only.
   */
  editorItems?: EditorItem[];
  /**
   * The layers and ids of features that are being updated. Different items should not reference the same layer multple times.
   * If this occurs, the item with the highest relative index takes priority, and object ids from earlier items are ignored.
   *
   * This array should be treated as read-only. To update a different set
   * of features, create a new workflow.
   *
   * @since 4.34
   */
  featureInfos?: FeatureInfo[] | null;
}

/**
 * This object supports the [Editor](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/) widget. It
 * contains data for the [UpdateFeaturesWorkflow](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/UpdateFeaturesWorkflow/).
 * This is accessed via the
 * [UpdateFeaturesWorkflow.data](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/UpdateFeaturesWorkflow/#data).
 */
export default class UpdateFeaturesWorkflowData extends EsriPromise {
  constructor(properties?: UpdateFeaturesWorkflowDataProperties);
  /**
   * The `EditorItem` objects from `EditorViewModel` corresponding to the
   *  layers/tables being updated.
   *
   * This array should be treated as read-only.
   */
  get editorItems(): EditorItem[];
  /**
   * The layers and ids of features that are being updated. Different items should not reference the same layer multple times.
   * If this occurs, the item with the highest relative index takes priority, and object ids from earlier items are ignored.
   *
   * This array should be treated as read-only. To update a different set
   * of features, create a new workflow.
   *
   * @since 4.34
   */
  get featureInfos(): FeatureInfo[] | null | undefined;
  /**
   * The features that are being updated.
   *
   * This array should be treated as read-only. To update a different set
   * of features, create a new workflow.
   */
  get features(): Graphic[];
  /**
   * The selected feature being updated. Null when in "batch" mode, where
   * multiple features are being updated.
   */
  accessor selectedFeature: Graphic | null | undefined;
  /** The associated [EditorViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/EditorViewModel/) for this workflow. */
  accessor viewModel: EditorViewModel;
}