/**
 * OrientedImageryViewer gallery utils for Components.
 *
 * @internal
 * @internal
 */
import type OrientedImageryLayer from "../../../layers/OrientedImageryLayer.js";
import type PixelBlock from "../../../layers/support/PixelBlock.js";
import type { AbortOptions } from "../../../core/promiseUtils.js";

/**
 * @internal
 * @internal
 */
export interface ImageSource {
  /**
   * The dataset format.
   * e.g., "TIFF" | "MRF" | "JPG"
   *
   * @internal
   */
  datasetFormat: string;
  /**
   * The url of the image source.
   *
   * @internal
   */
  url: string;
}

/**
 * @internal
 * @internal
 */
export interface GetImageSourceFromAttachmentProperties {
  /**
   * The oriented imagery layer.
   *
   * @internal
   */
  layer: OrientedImageryLayer;
  /**
   * The object id of the feature.
   *
   * @internal
   */
  objectId: number;
  /**
   * The abort options.
   *
   * @internal
   */
  options?: AbortOptions;
}

/**
 * @param properties - The properties to get the image source from attachment.
 * @internal
 * @internal
 */
export function getImageSourceFromAttachment(properties: GetImageSourceFromAttachmentProperties): Promise<ImageSource>;

/**
 * @param urlOrImageSource - The image source or url to get the thumbnail pixel block from.
 * @param options - The abort options.
 * @internal
 * @internal
 */
export function getThumbnailAsPixelBlock(urlOrImageSource: ImageSource | string, options?: AbortOptions): Promise<PixelBlock | null | undefined>;

/**
 * @internal
 * @internal
 */
export interface LoadImageFromAttachmentProperties {
  /**
   * The oriented imagery layer.
   *
   * @internal
   */
  layer?: OrientedImageryLayer | null;
  /**
   * The object id of the feature.
   *
   * @internal
   */
  objectId: number;
  /**
   * The abort options.
   *
   * @internal
   */
  options?: AbortOptions;
}

/**
 * @param properties - The properties to load the image for attachment.
 * @internal
 * @internal
 */
export function loadImageForAttachment(properties: LoadImageFromAttachmentProperties): Promise<PixelBlock | HTMLImageElement | null | undefined>;

/**
 * @param pixelBlockOrImageElement - The pixel block or HTML image element.
 * @param canvas - The canvas to render the image on.
 * @param rotation - The rotation angle in degrees.
 * @internal
 * @internal
 */
export function renderImageWithRotation(pixelBlockOrImageElement: HTMLImageElement | PixelBlock, canvas: HTMLCanvasElement, rotation?: number): void;