import type { SpriteInfo } from "./types.js";

/**
 * The sprite source returned from the [VectorTileLayer.setSpriteSource()](https://developers.arcgis.com/javascript/latest/references/core/layers/VectorTileLayer/#setSpriteSource) method.
 *
 * SpriteSource holds the resources needed to render patterned (textured) markers, lines and polygons. These resources are
 * both an image and metrics (JSON). Each element is identified by a unique name
 *
 * @since 5.0
 */
export default abstract class SpriteSource {
  /**
   * The base URL to where the sprites are (both JSON and PNG)
   *
   * @since 5.0
   */
  baseURL?: string | null;
  /**
   * The device pixel ratio of the sprite source.
   *
   * @default 1
   * @since 5.0
   */
  devicePixelRatio: number;
  /**
   * The height in pixels of the sprite source.
   *
   * @since 5.0
   */
  readonly height: number;
  /**
   * The sprite image data.
   *
   * @since 5.0
   */
  readonly image?: Uint8Array | null;
  /**
   * Indicates whether the sprite source is loaded successfully.
   *
   * @default "not-loaded"
   * @since 5.0
   */
  loadStatus: "not-loaded" | "loading" | "failed" | "loaded";
  /**
   * The width in pixels of the sprite source.
   *
   * @since 5.0
   */
  readonly width: number;
  /**
   * Returns the sprite info for the given sprite.
   *
   * @param name - Name of the sprite to get the information for.
   * @returns Sprite info containing the dimension and pixel ratio of the image and its location within the sprite image.
   * @since 4.25
   */
  getSpriteInfo(name: string): SpriteInfo | null | undefined;
}

/**
 * Returns information for the specified sprite.
 *
 * @deprecated since 5.0. use [getSpriteInfo()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SpriteSource/#getSpriteInfo) instead.
 */
export type GetSpriteInfo = SpriteSource["getSpriteInfo"];