/// <reference path="../../index.d.ts" />
import type Graphic from "@arcgis/core/Graphic.js";
import type FeatureLayer from "@arcgis/core/layers/FeatureLayer.js";
import type SubtypeGroupLayer from "@arcgis/core/layers/SubtypeGroupLayer.js";
import type MapView from "@arcgis/core/views/MapView.js";
import type SceneView from "@arcgis/core/views/SceneView.js";
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
import type { SupportedPasteCommand, ActiveFlowPage } from "./PasteViewModel.js";
import type { EsriClipboard } from "@arcgis/core/applications/Components/clipboard.js";
import type { ArcgisReferenceElement } from "../types.js";
import type { ClipboardStageChangedReason } from "./ClipboardMove.js";
import type { ApplySet, ApplySetLayerEditResult, ApplySetServiceEditResult } from "@arcgis/core/applications/Components/applySetUtils.js";
import type { PasteExecuteResult } from "./commands/PasteCommand.js";
import type { CustomPasteCommand } from "./commands/PasteCustomCommand.js";
import type { T9nMeta } from "@arcgis/lumina/controllers";

/**
 * The Paste component provides a UX for working with a Clipboard and
 * copy and pasting features and/or geometries.
 *
 * @cssproperty [--arcgis-paste-height] - Specifies the height of the component.
 * @cssproperty [--arcgis-paste-width] - Specifies the width of the component.
 * @cssproperty [--arcgis-paste-blocks-padding] - Specifies the padding for elements within the component.
 * @slot [home-header-actions-start] - Slot for adding actions to the start of the header on the entry page.
 * @slot [header-actions-end] - Slot for adding actions to the end of the header.
 * @slot [gallery-page-message] - Slot for adding content to the template gallery page.
 * @slot [commands-page-message] - Slot for adding content to commands page.
 * @since 5.0
 * @internal
 */
export abstract class ArcgisPaste extends LitElement {
  /** @internal */
  protected _messages: Partial<{
      componentLabel: string;
      noClipboardData: string;
      noPasteCommandsAvailable: string;
      pasteMultipleNotSupported: string;
      mixedGeometriesNotSupported: string;
      pasteAsMustHaveGeometry: string;
      clipboardContentsSingle: string;
      clipboardEmpty: string;
      clipboardContentsMany: string;
      clipboardContents: string;
      clipboardTooltip: string;
      pasteCommandChoices: string;
      pasteAsTitle: string;
      pasteMergeTitle: string;
      pasteTitle: string;
      cancel: string;
      close: string;
      tooManyCreateFeatures: string;
      tooManyCreateComplexFeatures: string;
      paste: string;
      pasteMany: string;
      attributesNotCopied: string;
      attributesSubtitle: string;
      preservethis: string;
      seeMergeOptions: string;
      selectionLabel: string;
      mergeOptionsTitle: string;
      features: string;
      mergeOptionsDesc: string;
      pasteWithAttributesLabel: string;
      preserved: string;
      pasteAppendTitle: string;
      pasteSubtractTitle: string;
      pasteAsDesc: string;
      pasteMergeDesc: string;
      pasteDesc: string;
      pasteAppendDesc: string;
      pasteSubtractDesc: string;
      choosefeature: string;
      next: string;
      updating: string;
      breadcrumb: string;
      back: string;
      noPasteItemsError: string;
      noChangeError: string;
      noSelectedError: string;
      noMatchingEditableLayers: string;
      deletesGeometryError: string;
      noGeometryError: string;
      unexpectedError: string;
      errorNoticeTitle: string;
      errorNoticeMessage: string;
      range: string;
      multipleFeaturesX: string;
  }> & T9nMeta<{
      componentLabel: string;
      noClipboardData: string;
      noPasteCommandsAvailable: string;
      pasteMultipleNotSupported: string;
      mixedGeometriesNotSupported: string;
      pasteAsMustHaveGeometry: string;
      clipboardContentsSingle: string;
      clipboardEmpty: string;
      clipboardContentsMany: string;
      clipboardContents: string;
      clipboardTooltip: string;
      pasteCommandChoices: string;
      pasteAsTitle: string;
      pasteMergeTitle: string;
      pasteTitle: string;
      cancel: string;
      close: string;
      tooManyCreateFeatures: string;
      tooManyCreateComplexFeatures: string;
      paste: string;
      pasteMany: string;
      attributesNotCopied: string;
      attributesSubtitle: string;
      preservethis: string;
      seeMergeOptions: string;
      selectionLabel: string;
      mergeOptionsTitle: string;
      features: string;
      mergeOptionsDesc: string;
      pasteWithAttributesLabel: string;
      preserved: string;
      pasteAppendTitle: string;
      pasteSubtractTitle: string;
      pasteAsDesc: string;
      pasteMergeDesc: string;
      pasteDesc: string;
      pasteAppendDesc: string;
      pasteSubtractDesc: string;
      choosefeature: string;
      next: string;
      updating: string;
      breadcrumb: string;
      back: string;
      noPasteItemsError: string;
      noChangeError: string;
      noSelectedError: string;
      noMatchingEditableLayers: string;
      deletesGeometryError: string;
      noGeometryError: string;
      unexpectedError: string;
      errorNoticeTitle: string;
      errorNoticeMessage: string;
      range: string;
      multipleFeaturesX: string;
  }>;
  /** The active flow page. */
  get activeFlowPage(): ActiveFlowPage;
  /**
   * Determines if the attributes panel should be shown for newly created paste features. If not set
   * the panel will only be shown if there are mandatory fields that have not been provided.
   *
   * @default false
   */
  accessor alwaysShowFeatureForm: boolean;
  /**
   * If true, the component will not be destroyed automatically when it is
   * disconnected from the document. This is useful when you want to move the
   * component to a different place on the page, or temporarily hide it. If this
   * is set, make sure to call the [destroy()](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-paste/#destroy) method when you are done to
   * prevent memory leaks.
   *
   * @default false
   */
  accessor autoDestroyDisabled: boolean;
  /** Called before the the paste is applied. */
  accessor beforeApply: (() => Promise<void>) | undefined;
  /** Access the application clipboard */
  get clipboard(): EsriClipboard;
  /**
   * Indicates whether a component is closed. When true, the component will be hidden.
   *
   * @default false
   */
  accessor closed: boolean;
  /**
   * Determines if the panel will automatically close after it has applied a Paste.
   *
   * @default false
   */
  accessor closeOnApply: boolean;
  /**
   * Determines if the component should show error notices
   *
   * @default false
   */
  accessor hideErrorNotice: boolean;
  /**
   * Determines if the footer should be hidden.
   *
   * @default false
   */
  accessor hideFooter: boolean;
  /**
   * Determines if the attributes panel should have a Cancel button in the Footer, or rely on the close header action
   *
   * @default false
   */
  accessor hideFooterCancelButton: boolean;
  /**
   * Determines if the component should have a close button. A close button can be added by using the header-actions-end slot.
   *
   * @default false
   */
  accessor hideHeaderCloseButton: boolean;
  /**
   * Indicates whether to display the tooltip for clipboard and other actions.
   *
   * @default false
   */
  accessor hideTooltips: boolean;
  /**
   * Determines if the view clipboard action is available
   *
   * @default false
   */
  accessor hideViewClipboard: boolean;
  /**
   * The highlight group to use when highlighting features when they are being created.
   *
   * @default "temporary"
   */
  accessor highlightGroup: string;
  /** Override how the paste component determines if a layer can be edited. */
  accessor layerPermissionsCheck: {
      canUpdate: (layer: FeatureLayer | SubtypeGroupLayer) => boolean;
      canCreate: (layer: FeatureLayer | SubtypeGroupLayer) => boolean;
  };
  /**
   * The maximum number of features that created by a paste operation.
   *
   * @default 2000
   * @name maximumFeatureCount
   */
  accessor maximumFeatureCount: number;
  /**
   * The maximum number of features that can created by a paste operation,
   * when there are complex Arcade expressions that must be executed.
   *
   * @default 50
   * @name maximumFeatureCountWithComplexForms
   */
  accessor maximumFeatureCountWithComplexForms: number;
  /** List of paste commands and whether they are available to be used. */
  accessor pasteCommandsState: Array<{
      id: SupportedPasteCommand;
      disabled: boolean;
      available: boolean;
  }>;
  /**
   * Determines whether pasting multiple features is supported
   *
   * @default false
   */
  accessor pasteWithMultipleFeaturesEnabled: boolean;
  /**
   * Determines whether pasting new features into multiple layers is allowed
   *
   * @default false
   */
  accessor pasteWithMultipleLayersEnabled: boolean;
  /**
   * By assigning the `id` attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene.
   *
   * @see [Associate components with a Map or Scene component](https://developers.arcgis.com/javascript/latest/programming-patterns/#associate-components-with-a-map-or-scene-component)
   */
  accessor referenceElement: ArcgisReferenceElement | string | undefined;
  /** Certain paste operations require a selected feature. If a feature is not provided, the operation will be disabled. */
  accessor selectedFeature: Graphic | undefined;
  /** The list of supported paste operations. New types of operations can be registered using the 'registerPasteOperation' */
  accessor supportedCommands: SupportedPasteCommand | SupportedPasteCommand[];
  /**
   * The view associated with the component. 
   *   > **Note:** The recommended approach is to fully migrate applications to use map and scene components and avoid using MapView and SceneView directly. However, if you are migrating a large application from widgets to components, you might prefer a more gradual transition. To support this use case, the SDK includes this `view` property which connects a component to a MapView or SceneView. Ultimately, once migration is complete, the arcgis-paste component will be associated with a map or scene component rather than using the `view` property.
   */
  accessor view: MapView | SceneView | undefined;
  /** Cancels any running Clipboard Move Interaction */
  cancelMoveClipboard(): Promise<void>;
  /** Permanently destroy the component */
  destroy(): Promise<void>;
  /**
   * Execute a paste command without opening the panel.
   *
   * param id - The paste commands identifier
   * param options.silent - Determines if the command is being run without UX, or if it is running with the panel open
   *
   * @param id
   * @param options
   */
  executePasteCommand(id: SupportedPasteCommand, options?: {
      silent?: boolean;
      showFeatureForm?: boolean;
  }): Promise<PasteExecuteResult>;
  /**
   * Registers a custom Paste Command
   *
   * @param pasteCommand
   */
  registerPasteCommand(pasteCommand: CustomPasteCommand): Promise<void>;
  /** Resets the Paste panel to its home page */
  reset(): Promise<void>;
  /**
   * Method to show the clipboard items on the map
   *
   * @param visible
   */
  showClipboardItems(visible: boolean): Promise<void>;
  /**
   * Start an interactive clipboard move operation
   *
   * @param continuous
   */
  startMoveClipboard(continuous: boolean): Promise<void>;
  /**
   * Method to write the paste edits to the geodatabase(s).
   *
   * @param applySet
   */
  writeChanges(applySet: ApplySet): Promise<(ApplySetLayerEditResult | ApplySetServiceEditResult)[]>;
  /** The user has initiated a paste command. */
  readonly arcgisApplyPasteCommand: import("@arcgis/lumina").TargetedEvent<this, {
      command: SupportedPasteCommand;
      completionCallback?: Promise<{
          success: boolean;
          errorCode?: string;
          errorMessage?: string;
      }> | Promise<void>;
      applySet?: ApplySet;
  }>;
  /** An error occurred performing a paste command */
  readonly arcgisApplyPasteError: import("@arcgis/lumina").TargetedEvent<this, {
      command: SupportedPasteCommand;
      errorMessage: string;
      errorCode: string;
  }>;
  /** The clipboard move interactive operation is about to start */
  readonly arcgisBeforeClipboardMove: import("@arcgis/lumina").TargetedEvent<this, void>;
  /** The clipboard move interactive operation has changed state. */
  readonly arcgisClipboardMoveStateChanged: import("@arcgis/lumina").TargetedEvent<this, { change: ClipboardStageChangedReason; }>;
  /**
   * Emitted when the component's close button is clicked.
   *
   * @since 5.0
   */
  readonly arcgisClose: import("@arcgis/lumina").TargetedEvent<this, void>;
  /** Emitted when the value of a property is changed. Use this to listen to changes to properties. */
  readonly arcgisPropertyChange: import("@arcgis/lumina").TargetedEvent<this, { name: "pasteCommandsState" | "activeFlowPage"; }>;
  /** Emitted when the component associated with a map or scene view is ready to be interacted with. */
  readonly arcgisReady: import("@arcgis/lumina").TargetedEvent<this, void>;
  readonly "@eventTypes": {
    arcgisApplyPasteCommand: ArcgisPaste["arcgisApplyPasteCommand"]["detail"];
    arcgisApplyPasteError: ArcgisPaste["arcgisApplyPasteError"]["detail"];
    arcgisBeforeClipboardMove: ArcgisPaste["arcgisBeforeClipboardMove"]["detail"];
    arcgisClipboardMoveStateChanged: ArcgisPaste["arcgisClipboardMoveStateChanged"]["detail"];
    arcgisClose: ArcgisPaste["arcgisClose"]["detail"];
    arcgisPropertyChange: ArcgisPaste["arcgisPropertyChange"]["detail"];
    arcgisReady: ArcgisPaste["arcgisReady"]["detail"];
  };
}