import type { JSONSupport, JSONSupportMixinProperties } from "../../../core/JSONSupport.js";
import type { ExifInfo } from "../../../layers/support/types.js";
import type { ObjectId } from "../../../views/types.js";

export interface AttachmentInfoProperties extends JSONSupportMixinProperties, Partial<Pick<AttachmentInfo, "contentType" | "exifInfo" | "globalId" | "id" | "keywords" | "name" | "parentGlobalId" | "parentObjectId" | "size" | "url">> {}

/**
 * An object containing properties specific to the orientation of an image attachment.
 * This information is stored within the attachment's [exifInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-query-support-AttachmentInfo.html#exifInfo).
 * In order to read this, you must first set the attachment query's [AttachmentQuery#returnMetadata](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttachmentQuery.html#returnMetadata)
 * to `true` to get the `exif` info associated with the attachment.
 */
export interface OrientationInfo {
  /** The identifier for the orientation info. */
  id: number;
  /** Indicates whether the image displays mirrored. */
  mirrored: boolean;
  /** The rotation value for the attached image. */
  rotation: number;
}

/**
 * The `AttachmentInfo` class returns information about attachments associated with a
 * feature. The contents of the attachment are streamed to the client.
 * Attachments are available if the [FeatureLayer.capabilities.data.supportsAttachment](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities)
 * is `true`.
 *
 * ![popuptemplate-attachments-element-list](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popup/popuptemplate-attachments-element-list.png)
 *
 * @since 4.19
 * @see [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html)
 * @see [AttachmentsContent](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-AttachmentsContent.html)
 * @see [Sample - Multiple popup elements](https://developers.arcgis.com/javascript/latest/sample-code/popup-multipleelements/)
 */
export default class AttachmentInfo extends JSONSupport {
  constructor(properties?: AttachmentInfoProperties);
  /**
   * The content type of the attachment. For example, `'image/jpeg'`.
   * See the [ArcGIS REST API documentation](https://developers.arcgis.com/rest/services-reference/query-attachments-feature-service-layer-.htm)
   * for more information on supported attachment types.
   */
  accessor contentType: string;
  /** An array of {@link layers/support/exifUtils!ExifInfo} for the attachment. */
  accessor exifInfo: ExifInfo[] | null | undefined;
  /** The global identifier for the attachment. */
  accessor globalId: string;
  /** The identifier for the attachment. */
  accessor id: number;
  /** Keywords used for the attachments. */
  accessor keywords: string;
  /** String value indicating the name of the file attachment. */
  accessor name: string;
  /**
   * The [OrientationInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-query-support-AttachmentInfo.html#OrientationInfo) for the attachment.
   * This is derived from the [exifInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-query-support-AttachmentInfo.html#exifInfo).
   * In order to read this, you must first set the attachment query's [AttachmentQuery#returnMetadata](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttachmentQuery.html#returnMetadata)
   * to `true` to get the `exif` info associated with the attachment.
   */
  get orientationInfo(): OrientationInfo;
  /** The parent or the feature global id of the attachment. */
  accessor parentGlobalId: string | null | undefined;
  /** The parent or the feature object id of the attachment. */
  accessor parentObjectId: ObjectId | null | undefined;
  /** The file size of the attachment. This is specified in bytes. */
  accessor size: number;
  /** The URL of the attachment. */
  accessor url: string | null | undefined;
  /**
   * Creates a deep clone of the AttachmentInfo class.
   *
   * @returns A deep clone of the AttachmentInfo instance.
   */
  clone(): AttachmentInfo;
}