import type Input from "./Input.js";
import type { AudioInputProperties } from "./AudioInput.js";
import type { DocumentInputProperties } from "./DocumentInput.js";
import type { ImageInputProperties } from "./ImageInput.js";
import type { SignatureInputProperties } from "./SignatureInput.js";
import type { NestableAttachmentInputUnion } from "./types.js";
import type { VideoInputProperties } from "./VideoInput.js";
import type { FormAttachmentAssociationType } from "../../../../portal/jsonTypes.js";

/** @since 5.1 */
export interface AttachmentInputProperties extends Partial<Pick<AttachmentInput, "attachmentAssociationType">> {
  /**
   * Available inputs to add an attachment.
   *
   * @since 5.1
   * @see [AudioInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/AudioInput/)
   * @see [DocumentInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/DocumentInput/)
   * @see [ImageInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/ImageInput/)
   * @see [SignatureInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/SignatureInput/)
   * @see [VideoInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/VideoInput/)
   */
  inputTypes?: ((AudioInputProperties & { type: "audio"; }) | (DocumentInputProperties & { type: "document"; }) | (ImageInputProperties & { type: "image"; }) | (SignatureInputProperties & { type: "signature"; }) | (VideoInputProperties & { type: "video"; }))[] | null;
}

/**
 * The `AttachmentInput` class defines a user interface for an attachment input. This [AttachmentElement.input](https://developers.arcgis.com/javascript/latest/references/core/form/elements/AttachmentElement/#input) is used in [attachment elements](https://developers.arcgis.com/javascript/latest/references/core/form/elements/AttachmentElement/) that are set on the [Editor's `layerInfo.formTemplate`](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-editor/#layerInfos/) or a [feature layer's `formTemplate`](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#formTemplate) and displayed within the [Editor](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-editor/). The `AttachmentInput` offers the most flexibility, and allows a number of different attachment types to be included in a single attachment element.
 *
 * > [!CAUTION]
 * > * Input methods that are configured as only allowing `capture` are not supported on desktop devices for inputs such as [AudioInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/AudioInput/), [ImageInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/ImageInput/), or [VideoInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/VideoInput/).
 * > * For inputs such as [AudioInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/AudioInput/), [ImageInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/ImageInput/), or [VideoInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/VideoInput/), minimum requirements apply only in mobile editing workflows when the input method is set to only allow capture and the minimum file count is greater than or equal to one.
 *
 * @since 5.1
 * @see [AttachmentElement](https://developers.arcgis.com/javascript/latest/references/core/form/elements/AttachmentElement/)
 * @see [AudioInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/AudioInput/)
 * @see [DocumentInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/DocumentInput/)
 * @see [ImageInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/ImageInput/)
 * @see [VideoInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/VideoInput/)
 * @example
 * // Create the new input types for the general attachment input
 * const audioInput = new AudioInput({
 *   inputMethod: "any",
 *   maxDuration: 30,
 * });
 *
 * const imageInput = new ImageInput({
 *   inputMethod: "upload",
 *   maxImageSize: 800,
 * });
 *
 * const documentInput = new DocumentInput({
 *   maxFileSize: 500,
 * });
 *
 * const videoInput = new VideoInput({
 *   inputMethod: "any",
 *   maxDuration: 90,
 * });
 *
 * // Create the general attachment input that allows for multiple types of attachments
 * const attachmentInput = new AttachmentInput({
 *   attachmentAssociationType: "any", // Associates all existing attachments to this element.
 *   inputTypes: [documentInput, audioInput, imageInput, videoInput]
 * });
 */
export default class AttachmentInput extends Input {
  /** @since 5.1 */
  constructor(properties?: AttachmentInputProperties);
  /**
   * String value which indicates if existing attachments should be associated with the element and how they should be associated. This property is used in conjunction with the [AttachmentElement.attachmentKeyword](https://developers.arcgis.com/javascript/latest/references/core/form/elements/AttachmentElement/#attachmentKeyword) property.
   *
   * The table below describes the options.
   *
   * value | description |
   * --------------|---------------------------
   * `any` | Include all existing attachments associated with this feature regardless of their keyword value. This option is only available if there are no existing [attachment elements](https://developers.arcgis.com/javascript/latest/references/core/form/elements/AttachmentElement/) in the form. If an attachment element has this set, additional attachment elements cannot be added to the form.
   * `exact` | Only attachments whose keyword matches the form element's [keyword](https://developers.arcgis.com/javascript/latest/references/core/form/elements/AttachmentElement/#attachmentKeyword)  will be shown.
   * `exactOrNone` | Associates attachments whose keyword matches the [attachmentKeyword](https://developers.arcgis.com/javascript/latest/references/core/form/elements/AttachmentElement/#attachmentKeyword) and those that do not have a keyword. Only one attachment element with `exactOrNone` can be used within a form and it cannot be used in conjunction with any other attachment element that has an `attachmentAssociationType` value of `exact` or `any`.
   *
   * @default "exact"
   * @since 5.1
   * @see [AttachmentElement.attachmentKeyword](https://developers.arcgis.com/javascript/latest/references/core/form/elements/AttachmentElement/#attachmentKeyword)
   */
  accessor attachmentAssociationType: FormAttachmentAssociationType;
  /**
   * Available inputs to add an attachment.
   *
   * @since 5.1
   * @see [AudioInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/AudioInput/)
   * @see [DocumentInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/DocumentInput/)
   * @see [ImageInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/ImageInput/)
   * @see [SignatureInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/SignatureInput/)
   * @see [VideoInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/attachments/VideoInput/)
   */
  get inputTypes(): NestableAttachmentInputUnion[] | null;
  set inputTypes(value: ((AudioInputProperties & { type: "audio"; }) | (DocumentInputProperties & { type: "document"; }) | (ImageInputProperties & { type: "image"; }) | (SignatureInputProperties & { type: "signature"; }) | (VideoInputProperties & { type: "video"; }))[] | null | undefined);
  /**
   * The input type identifier.
   *
   * @since 5.1
   */
  get type(): "attachment";
}