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

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

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

/**
 * @param properties - The properties to get the image source from attachment.
 * @experimental
 * @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.
 * @experimental
 * @internal
 */
export function getThumbnailAsPixelBlock(urlOrImageSource: ImageSource | string, options?: AbortOptions): Promise<PixelBlock | null | undefined>;

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

/**
 * @param properties - The properties to load the image for attachment.
 * @experimental
 * @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.
 * @experimental
 * @internal
 */
export function renderImageWithRotation(pixelBlockOrImageElement: HTMLImageElement | PixelBlock, canvas: HTMLCanvasElement, rotation?: number): void;