/**
 * A utility function for accessing node movement method on Link Chart Views (not yet public) .
 *
 * @internal
 * @internal
 */
import type Graphic from "../../Graphic.js";
import type Point from "../../geometry/Point.js";
import type LinkChartView from "../../views/LinkChartView.js";
import type { ResourceHandle } from "../../core/Handles.js";

/**
 * Starts a node movement reshape operation in the LinkChartView.
 *
 * @param targetEntityId - The ID of the entity to be moved.
 * @param targetEntityType - The type of the entity to be moved.
 * @param targetView - The LinkChartView in which the node movement reshape operation will take place.
 * @param options - Optional parameters.
 * @internal
 * @internal
 */
export function studioStartNodeMovement(targetEntityId: string, targetEntityType: string, targetView: LinkChartView, options?: { useSnappingGrid?: boolean; }): Promise<StudioNodeMovementReturnType>;

/**
 * @internal
 * @internal
 */
export interface StudioNodeMovementReturnType {
  /** @internal */
  commitNodeMovement: () => Promise<Point>;
  /** @internal */
  cancelNodeMovement: () => void;
}

/**
 * Registers a callback to be called when the node movement reshape operation stops.
 *
 * @param targetView - The LinkChartView in which the node movement reshape operation is taking place.
 * @param movementStopCallback - The callback function to be called when the node movement stops.
 * @internal
 * @internal
 */
export function onNodeMovementStop(targetView: LinkChartView, movementStopCallback: MovementStopCallback): ResourceHandle;

/**
 * @param event - The event object containing information about the node movement.
 * @internal
 * @internal
 */
export type MovementStopCallback = (event: MovementStopCallbackEvent) => void;

/**
 * @internal
 * @internal
 */
export interface MovementStopCallbackEvent {
  /**
   * The graphic representing the node being moved.
   *
   * @internal
   */
  mover: Graphic;
  /**
   * The change in the x-coordinate of the node's position.
   *
   * @internal
   */
  dx: number;
  /**
   * The change in the y-coordinate of the node's position.
   *
   * @internal
   */
  dy: number;
}