import type Graphic from "../../Graphic.js";
import type Collection from "../../core/Collection.js";
import type FeatureLayer from "../../layers/FeatureLayer.js";
import type SubtypeGroupLayer from "../../layers/SubtypeGroupLayer.js";
import type SubtypeSublayer from "../../layers/support/SubtypeSublayer.js";
import type { GeometryType } from "../../geometry/types.js";

/**
 * The type of layers which are supported by the clipboard
 *
 * @internal
 * @internal
 */
export type ClipboardSupportedLayer = FeatureLayer | SubtypeGroupLayer | SubtypeSublayer;

/**
 * An item on the clipboard
 *
 * @internal
 * @internal
 */
export interface ClipboardItem {
  /**
   * The layer to which the clipboard item is associated
   *
   * @internal
   */
  layer: ClipboardSupportedLayer | null;
  /**
   * The graphic that has been placed in the clipboard
   *
   * @internal
   */
  graphic: Graphic;
  /**
   * The type of clipboard item
   *
   * @internal
   */
  type: "feature" | "string";
}

/**
 * An application clipboard for use with types of arcgis data
 *
 * @internal
 * @internal
 */
export interface EsriClipboard {
  /**
   * Set the contents of the clipboard. All graphics will be cloned and represent the characteristics of the graphics at the point at which they were added to the clipboard.
   *
   * @param data
   * @internal
   */
  setData(data: {
      layer: ClipboardSupportedLayer | null;
      graphic: Graphic;
      type: "feature" | "string";
  }[] | Graphic[]): void;
  /**
   * Flag to indicate if there are any features on the clipboard.
   *
   * @internal
   */
  get hasItems(): boolean;
  /**
   * The list of features on the clipboard
   * *
   *
   * @internal
   */
  get items(): Collection<ClipboardItem>;
  /**
   * Flag to indicate if the clipboard has items that may have relationships
   *
   * @internal
   */
  get hasDestinationRelationships(): boolean;
  /**
   * The list of geometry types that are currently held on the clipboard.
   *
   * @internal
   */
  get geometryTypes(): Set<GeometryType>;
  /**
   * The single type of geometry that all features on the clipboard share. If the clipboard contains features with different geometry types, then "" will be returned.
   *
   * @internal
   */
  get singleGeometryType(): GeometryType | null | undefined;
  /**
   * A number which increments when the clipboard contents are changed.
   *
   * @internal
   */
  get version(): number;
}

/**
 * Returns a singleton application clipboard
 *
 * @internal
 * @internal
 */
export function getApplicationClipboard(): EsriClipboard;