import type { LayerEvents } from "../Layer.js";
import type { EditsResultEvent } from "../graphics/editingSupport.js";

export interface EditBusLayerProperties {}

export interface EditBusLayerEvents extends LayerEvents {
  /**
   * Fires after [FeatureLayer#applyEdits()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits) is completed successfully.
   * The event payload includes only successful edits, not the failed edits.
   * `applyEdits()` will pass in a `sessionId` during an active edit session.
   *
   * @since 4.12
   * @see [FeatureLayer#applyEdits()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits)
   * @example
   * // This function will fire each time applyEdits() is completed successfully
   * layer.on("edits", function(event) {
   *
   *   const extractObjectId = function(result) {
   *     return result.objectId;
   *   };
   *
   *   const adds = event.addedFeatures.map(extractObjectId);
   *   console.log("addedFeatures: ", adds.length, adds);
   *
   *   const updates = event.updatedFeatures.map(extractObjectId);
   *   console.log("updatedFeatures: ", updates.length, updates);
   *
   *   const deletes = event.deletedFeatures.map(extractObjectId);
   *   console.log("deletedFeatures: ", deletes.length, deletes);
   * });
   */
  edits: EditsResultEvent;
}

export abstract class EditBusLayer {
  constructor(...args: any[]);
  /**
   * @deprecated
   * Do not directly reference this property.
   * Use EventNames and EventTypes helpers from \@arcgis/core/Evented
   */
  "@eventTypes": EditBusLayerEvents;
}