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
 *
 * @experimental
 * @internal
 */
export type ClipboardSupportedLayer = FeatureLayer | SubtypeGroupLayer | SubtypeSublayer;

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

/**
 * An application clipboard for use with types of arcgis data
 *
 * @experimental
 * @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
   * @experimental
   */
  setData(data: {
      layer: ClipboardSupportedLayer | null;
      graphic: Graphic;
      type: "feature" | "string";
  }[] | Graphic[]): void;
  /**
   * Flag to indicate if there are any features on the clipboard.
   *
   * @experimental
   */
  get hasItems(): boolean;
  /**
   * The list of features on the clipboard
   * *
   *
   * @experimental
   */
  get items(): Collection<ClipboardItem>;
  /**
   * Flag to indicate if the clipboard has items that may have relationships
   *
   * @experimental
   */
  get hasDestinationRelationships(): boolean;
  /**
   * The list of geometry types that are currently held on the clipboard.
   *
   * @experimental
   */
  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.
   *
   * @experimental
   */
  get singleGeometryType(): GeometryType | null | undefined;
  /**
   * A number which increments when the clipboard contents are changed.
   *
   * @experimental
   */
  get version(): number;
}

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