import type SpatialReference from "../geometry/SpatialReference.js";
import type Layer from "./Layer.js";
import type TileInfo from "./support/TileInfo.js";
import type { MultiOriginJSONSupportMixin } from "../core/MultiOriginJSONSupport.js";
import type { AbortOptions } from "../core/promiseUtils.js";
import type { BlendLayer, BlendLayerProperties } from "./mixins/BlendLayer.js";
import type { OperationalLayer, OperationalLayerProperties } from "./mixins/OperationalLayer.js";
import type { PortalLayer, PortalLayerProperties } from "./mixins/PortalLayer.js";
import type { RefreshableLayer, RefreshableLayerProperties } from "./mixins/RefreshableLayer.js";
import type { ScaleRangeLayer, ScaleRangeLayerProperties } from "./mixins/ScaleRangeLayer.js";
import type { TileInfoProperties } from "./support/TileInfo.js";
import type { LayerProperties } from "./Layer.js";

export interface WebTileLayerProperties extends LayerProperties, PortalLayerProperties, OperationalLayerProperties, ScaleRangeLayerProperties, RefreshableLayerProperties, BlendLayerProperties, Partial<Pick<WebTileLayer, "copyright" | "subDomains" | "urlTemplate">> {
  /** The tiling scheme information for the layer. */
  tileInfo?: TileInfoProperties;
}

/**
 * WebTileLayer provides a simple way to add non-ArcGIS Server map tiles as a layer to a map.
 * The constructor takes a URL template that usually follows a pattern of
 * `http://some.domain.com/{level}/{col}/{row}/` where `level` corresponds to a zoom level, and
 * `column` and `row` represent tile column and row, respectively. This pattern is not required, but
 * is the most common one currently on the web.
 *
 * The [subDomains](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/#subDomains) property can be used to specify subDomains where tiles are served to
 * speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent
 * requests to a domain). If subDomains are specified, the [urlTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/#urlTemplate) should include a `{subDomain}` place
 * holder. The [copyright](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/#copyright) property can be used to define attribution information that will be displayed
 * in the map's Attribution widget.
 *
 * If the service is requested from a different domain, a [CORS enabled server](https://developers.arcgis.com/javascript/latest/cors/) or a [proxy](https://developers.arcgis.com/javascript/latest/proxies/) is
 * required.
 *
 * > [!WARNING]
 * >
 * > When adding a WebTileLayer to a map in a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/) with local
 * > [SceneView.viewingMode](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#viewingMode), the [fullExtent](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/#fullExtent) property must be set
 * > on the layer.
 *
 * > [!WARNING]
 * >
 * > Esri requires that when you use an ArcGIS Online basemap in your app, the map must include Esri attribution and you must be licensed to use the content.
 * > For detailed guidelines on working with attribution, please visit the official [attribution in your app](https://developers.arcgis.com/documentation/mapping-and-location-services/reference/basemap-attribution/) documentation.
 * > For information, see the [Terms of Use documentation](https://developers.arcgis.com/documentation/terms-of-use/).
 *
 * @since 4.0
 * @see [Sample - WebTileLayer (3D)](https://developers.arcgis.com/javascript/latest/sample-code/layers-webtile-3d/)
 * @see [TileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/)
 */
export default class WebTileLayer extends WebTileLayerSuperclass {
  constructor(properties?: WebTileLayerProperties);
  /**
   * The attribution information for the layer.
   *
   * @default ""
   */
  accessor copyright: string;
  /**
   * Indicates whether the layer instance has loaded.
   * When `true`, all the properties of the object can be accessed.
   *
   * @default false
   */
  get loaded(): boolean;
  /**
   * The spatial reference of the layer.
   *
   * @default SpatialReference.WebMercator // wkid: 3857
   */
  get spatialReference(): SpatialReference;
  /**
   * A string of subDomain names where tiles are served to speed up tile retrieval.
   * If subDomains are specified, the [urlTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/#urlTemplate) should include a
   * `{subDomain}` place holder.
   *
   * @see [WebTileLayer.urlTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/#urlTemplate)
   * @example
   * // add an open street map layer
   * new WebTileLayer({
   *   "https://{subDomain}.tile.openstreetmap.org/{z}/{x}/{y}.png",
   *   subDomains: ["a", "b", "c"],
   * });
   */
  accessor subDomains: string[] | null | undefined;
  /** The tiling scheme information for the layer. */
  get tileInfo(): TileInfo;
  set tileInfo(value: TileInfoProperties);
  /**
   * The list of tile server urls for the layer.
   * It's computed from the [urlTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/#urlTemplate) and the list of [subDomains](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/#subDomains)
   */
  get tileServers(): string[] | null | undefined;
  /**
   * For [WebTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/) the type is `web-tile`.
   *
   * @default "web-tile"
   */
  get type(): "web-tile" | "open-street-map";
  /**
   * The url template is a string that specifies the URL of the hosted tile images to load. The url template resembles an absolute URL but with a number
   * of placeholder strings that the source evaluates to decide which tiles to load.
   *
   * The url template can follow a pattern of `https://some.domain.com/{level}/{col}/{row}/` where `level` corresponds to a zoom level, and `column` and `row` represent a
   * tile column and row, respectively. It can also follow a pattern of `https://some.domain.com/{z}/{x}/{y}/` where `z` corresponds to a zoom level, and `x` and `y` represent
   * a tile location along x and y axis.
   *
   * The `urlTemplate` should contain a `{subDomain}` place holder if [subDomains](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/#subDomains) are specified.
   *
   * @see [WebTileLayer.subDomains](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/#subDomains)
   * @example
   * // add an open street map layer
   * new WebTileLayer({
   *   "https://{subDomain}.tile.openstreetmap.org/{z}/{x}/{y}.png",
   *   subDomains: ["a", "b", "c"],
   * });
   */
  accessor urlTemplate: string | null | undefined;
  /**
   * This method fetches a tile for the given level, row and column present in the view.
   *
   * @param level - Level of detail of the tile to fetch. This value is provided by [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/).
   * @param row - The row(y) position of the tile fetch. This value is provided by [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/).
   * @param col - The column(x) position of the tile to fetch. This value is provided by [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/).
   * @param options - Optional settings for the tile request. The options have the following properties.
   * @returns Returns a promise that resolves to an
   * [HTMLImageElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement).
   */
  fetchTile(level: number, row: number, col: number, options?: AbortOptions): Promise<HTMLImageElement>;
  /**
   * This method returns a URL to a tile for a given level, row and column.
   *
   * @param level - The requested tile's level.
   * @param row - The requested tile's row.
   * @param col - The requested tile's column.
   * @returns Returns the tile URL.
   */
  getTileUrl(level: number, row: number, col: number): string;
}
declare const WebTileLayerSuperclass: typeof Layer & typeof MultiOriginJSONSupportMixin & typeof PortalLayer & typeof OperationalLayer & typeof ScaleRangeLayer & typeof RefreshableLayer & typeof BlendLayer