import type Collection from "../core/Collection.js";
import type Extent from "../geometry/Extent.js";
import type Layer from "./Layer.js";
import type Sublayer from "./support/Sublayer.js";
import type PortalItem from "../portal/PortalItem.js";
import type { MultiOriginJSONMixin, MultiOriginJSONMixinProperties } from "../core/MultiOriginJSONSupport.js";
import type { LayerEvents, LayerProperties } from "./Layer.js";
import type { FetchImageOptions } from "./types.js";
import type { APIKeyMixin, APIKeyMixinProperties } from "./mixins/APIKeyMixin.js";
import type { ArcGISMapService, ArcGISMapServiceProperties } from "./mixins/ArcGISMapService.js";
import type { ArcGISService, ArcGISServiceProperties } from "./mixins/ArcGISService.js";
import type { BlendLayer, BlendLayerProperties } from "./mixins/BlendLayer.js";
import type { CustomParametersMixin, CustomParametersMixinProperties } from "./mixins/CustomParametersMixin.js";
import type { OperationalLayer, OperationalLayerProperties } from "./mixins/OperationalLayer.js";
import type { PortalLayer, PortalLayerProperties } from "./mixins/PortalLayer.js";
import type { RefreshableLayerEvents, RefreshableLayer, RefreshableLayerProperties } from "./mixins/RefreshableLayer.js";
import type { ScaleRangeLayer, ScaleRangeLayerProperties } from "./mixins/ScaleRangeLayer.js";
import type { SublayersOwner, SublayersOwnerProperties } from "./mixins/SublayersOwner.js";
import type { TemporalLayer, TemporalLayerProperties } from "./mixins/TemporalLayer.js";
import type { SaveAsOptions, SaveOptions } from "./mixins/properties/ILayerWithSave.js";
import type { PortalItemProperties } from "../portal/PortalItem.js";
import type { TimeZone } from "../time/types.js";
import type { SublayerProperties } from "./support/Sublayer.js";
import type { ReadonlyArrayOrCollection } from "../core/Collection.js";

export interface MapImageLayerProperties extends LayerProperties, CustomParametersMixinProperties, APIKeyMixinProperties, RefreshableLayerProperties, MultiOriginJSONMixinProperties, PortalLayerProperties, OperationalLayerProperties, ArcGISServiceProperties, ArcGISMapServiceProperties, SublayersOwnerProperties, ScaleRangeLayerProperties, TemporalLayerProperties, BlendLayerProperties, Partial<Pick<MapImageLayer, "dpi" | "gdbVersion" | "imageFormat" | "imageMaxHeight" | "imageMaxWidth" | "imageTransparency" | "sourceJSON" | "url">> {
  /**
   * The portal item from which the layer is loaded. This will load the layer
   * along with any overridden properties (e.g. renderers, definition expressions, etc.) saved
   * to the portal item, not the map service.
   *
   * @example
   * let layer = new MapImageLayer({
   *   portalItem: {  // autocasts as new PortalItem()
   *     id: "caa9bd9da1f4487cb4989824053bb847"
   *   }
   * });
   * @example
   * // While this example uses FeatureLayer, this same pattern can be
   * // used for other layers that may be loaded from portalItem ids.
   * const layer = new FeatureLayer({
   *   portalItem: {  // autocasts as new PortalItem()
   *     id: "caa9bd9da1f4487cb4989824053bb847"
   *   }  // the first layer in the service is returned
   * });
   * @example
   * // Set hostname when using an on-premise portal (default is ArcGIS Online)
   * // esriConfig.portalUrl = "http://myHostName.esri.com/arcgis";
   *
   * // While this example uses FeatureLayer, this same pattern can be
   * // used for SceneLayers.
   * const layer = new FeatureLayer({
   *   portalItem: {  // autocasts as new PortalItem()
   *     id: "8d26f04f31f642b6828b7023b84c2188"
   *   },
   *   // loads the third item in the given feature service
   *   layerId: 2
   * });
   * @example
   * // Initialize GeoJSONLayer by referencing a portalItem id pointing to geojson file.
   * const layer = new GeoJSONLayer({
   *   portalItem: new PortalItem({
   *     id: "81e769cd7031482797e1b0768f23c7e1",
   *     // optionally define the portal, of the item.
   *     // if not specified, the default portal defined is used.
   *     // see https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#portalUrl
   *     portal: new Portal({
   *       url: "https://jsapi.maps.arcgis.com/"
   *     })
   *   }
   * });
   * @example
   * // This snippet loads a table hosted in ArcGIS Online.
   * const table = new FeatureLayer({
   *   portalItem: { // autocasts as esri/portal/PortalItem
   *     id: "123f4410054b43d7a0bacc1533ceb8dc"
   *   }
   * });
   *
   * // Before adding the table to the map, it must first be loaded and confirm it is the right type.
   * table.load().then(() => {
   *   if (table.isTable) {
   *     map.tables.add(table);
   *   }
   * });
   * @example
   * // While this example uses FeatureLayer, this same pattern can be
   * // used for other layers that may be loaded from portalItem ids.
   * const layer = new FeatureLayer({
   *   portalItem: { // autocasts as esri/portal/PortalItem
   *     id: "caa9bd9da1f4487cb4989824053bb847",
   *     // Set an API key to access a secure portal item configured with API key authentication.
   *     apiKey: "APIKEY"
   *   }
   * });
   */
  portalItem?: PortalItemProperties | null;
  /**
   * A [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) objects
   * that allow you to alter
   * the properties of one or more sublayers of the MapImageLayer. If this property
   * is not specified, all the sublayers from the service are displayed as defined in the
   * service. If an empty array is passed to this property then none of the sublayers
   * from the service are displayed in the layer.
   *
   * All sublayers are referenced in the order in which they are drawn in the view (bottom to top).
   * They may be [added](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#add),
   * [removed](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#remove), or
   * [reordered](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#reorder) using the
   * [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) methods. Because [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) extends
   * [Accessor](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Accessor.html), its properties may be
   * [watched](https://developers.arcgis.com/javascript/latest/watch-for-changes/#watch-for-changes-in-the-api).
   *
   * @example
   * // Only includes the first sublayer from the map service
   * let layer = new MapImageLayer({
   *   url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",
   *   sublayers: [{
   *     id: 0
   *   }]
   * });
   * @example
   * // toggles the visibility of the first sublayer to false
   * layer.findSublayerById(0).visible = false;
   * @example
   * // sublayers from the service are excluded from the layer
   * layer = new MapImageLayer({
   *   url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",
   *   sublayers: []
   * });
   * @example
   * // Moves the cities sublayer from index 3 to index 0.
   * let citiesLayer = layer.sublayers.at(3);
   * layer.sublayers.reorder(citiesLayer, 0);
   * @example
   * // Overrides the drawing info on the layer with a custom renderer
   * let citiesLayer = layer.sublayers.at(3);
   * citiesLayer.renderer = {
   *   type: "simple",  // autocasts as new SimpleRenderer()
   *   symbol: {
   *     type: "simple-marker",  // autocasts as new SimpleMarkerSymbol()
   *     color: "blue",
   *     size: 3
   *   }
   * };
   */
  sublayers?: ReadonlyArrayOrCollection<SublayerProperties> | null;
  /**
   * The title of the layer used to identify it in places such as the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-legend/)
   * and [LayerList](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html).
   *
   * When loading a layer by service url, the title is derived from the service name.
   * The titles for the sublayers will be the same as the names of the sublayers in the service.
   * When the layer is loaded from a portal item, the title of the portal item will be used instead.
   * Finally, if a layer is loaded as part of a webmap or a webscene, then the title of the layer as stored in the webmap/webscene will be used.
   */
  title?: string | null;
}

export interface MapImageLayerEvents extends RefreshableLayerEvents, LayerEvents {}

/**
 * ## Overview
 *
 * MapImageLayer allows you to display and analyze data from
 * [sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#sublayers) defined in a
 * [map service](https://enterprise.arcgis.com/en/server/latest/publish-services/windows/what-is-a-map-service.htm), exporting images
 * instead of features. Map service images are
 * dynamically generated on the server based on a request, which includes an
 * LOD (level of detail), a bounding box, dpi, spatial reference and other
 * options. In 2D, the exported image is of the entire map extent specified.
 * In 3D, two images are exported: an image with higher resolution for the area closer to the camera and
 * a lower resolution image for the area farther away from the camera.
 *
 * > [!WARNING]
 * >
 * > Unlike [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html), MapImageLayer processing
 * > is handled by the server, not the client. Offloading the processing to the
 * > server allows MapImageLayer to render more features with a higher level
 * > of performance in some cases.
 *
 * MapImageLayer does not display tiled images. To display
 * tiled map service layers, see [TileLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-TileLayer.html).
 *
 * ## Creating a MapImageLayer
 *
 * MapImageLayer may be created in one of two ways: from a [service URL](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#url) or from an ArcGIS
 * Portal [item ID](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#portalItem).
 *
 * ### Reference a service URL
 *
 * To create a MapImageLayer instance from a service, you must set the [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#url) property
 * to the REST endpoint of a layer in a Map Service. The URL will typically look
 * like the following.
 *
 * ```js
 * https://<hostname>/arcgis/rest/services/<service-name>/MapServer
 * ```
 *
 * For a layer to be visible in a view, it must be added to the [Map](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html)
 * referenced by the view. See [Map#add()](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#add) for information about adding layers to a map.
 *
 * ```js
 * const MapImageLayer = await $arcgis.import("@arcgis/core/layers/MapImageLayer.js");
 * // points to the states layer in a service storing U.S. census data
 * let layer = new MapImageLayer({
 *   url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer"
 * });
 * map.add(layer);  // adds the layer to the map
 * ```
 *
 * If the map 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.
 *
 * ### Reference an ArcGIS portal Item ID
 *
 * You can also create a MapImageLayer from its ID if it exists as an item in ArcGIS Online or ArcGIS Enterprise.
 * For example, the following snippet shows how to add a new MapImageLayer instance to a map using the
 * [portalItem](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#portalItem) property.
 *
 * ```js
 * // references an ArcGIS Online item pointing to a Map Service Layer
 * let layer = new MapImageLayer({
 *   portalItem: {  // autocasts as esri/portal/PortalItem
 *     id: "8444e275037549c1acab02d2626daaee"
 *   }
 * });
 * map.add(layer);  // adds the layer to the map
 * ```
 *
 * ## Sublayers
 *
 * Map services contain one or more sublayers. Sublayers may even contain nested sublayers.
 * When the [sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#sublayers) property of the MapImageLayer is not specified, then an image of all sublayers
 * in the service is exported to the client. If a subset of sublayers from the service are
 * specified, then only the subset of sublayers are rendered on the client.
 * Sublayers have default rendering, scale visibility, labels, and other properties saved to the server. However, these properties may be dynamically
 * changed so a new map image is exported to the view. Sublayers of a MapImageLayer can only be styled with 2D symbology even if they are rendered in
 * a [WebScene](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html).
 * To learn more about working with sublayers, see the [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) API
 * documentation.
 *
 * [![mapimagelayer-renderer](https://developers.arcgis.com/javascript/latest/assets/img/apiref/layers/mapimagelayer-renderer.png)](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-renderers/)
 *
 * <span id="dynamic-layers"></span>
 * ## Dynamic layers
 *
 * Sublayers may be rendered on the fly as dynamic layers. There are two types of dynamic layers:
 * [MapLayerSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-source-MapLayerSource.html) and
 * [DataLayerSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-source-DataLayerSource.html).
 *
 * [Dynamic map layers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-source-MapLayerSource.html) allow you
 * to override sublayers in the map service with new renderers,
 * definition expressions, opacity, scale visibility, etc. Multiple dynamic map layers may exist
 * for a single map service layer.
 *
 * [Dynamic data layers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-source-DataLayerSource.html) provide
 * the ability to create layers on the fly from data referenced in
 * registered workspaces.
 * The data may be tables with or without geometries, feature classes, and
 * rasters. These data sources are not directly visible to the services directory, but may be
 * published and configured with the ArcGIS Server Manager.
 * Data from tables may be joined to other tables or dynamic map layers.
 *
 * > [!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/terms/attribution/) documentation.
 * > For information on terms of use, see the [Terms of Use FAQ](https://developers.arcgis.com/terms/faq/).
 *
 * @since 4.0
 * @see [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html)
 * @see [TileLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-TileLayer.html)
 * @see [Sample - MapImageLayer](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer/)
 * @see [Sample - MapImageLayer: toggle sublayer visibility](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-sublayers/)
 * @see [Sample - MapImageLayer: set definition expression](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-definitionexpression/)
 * @see [Sample - MapImageLayer: set renderers on sublayers](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-renderers/)
 * @see [Sample - MapImageLayer: label sublayer features](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-dynamic-labels/)
 * @see [Sample - MapImageLayer: create dynamic map layers](https://developers.arcgis.com/javascript/latest/sample-code/layers-dynamicmaplayer/)
 * @see [Sample - MapImageLayer: dynamic data layer with table join](https://developers.arcgis.com/javascript/latest/sample-code/layers-dynamicdatalayer-table-join/)
 * @see [Sample - MapImageLayer: dynamic data layer with query table](https://developers.arcgis.com/javascript/latest/sample-code/layers-dynamicdatalayer-query-table/)
 * @see [Sample - MapImageLayer: dynamic data layer with raster](https://developers.arcgis.com/javascript/latest/sample-code/layers-dynamicdatalayer-raster/)
 * @example
 * let layer = new MapImageLayer({
 * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",
 *   sublayers: [
 *    {
 *      id: 3,
 *      visible: false
 *    }, {
 *      id: 2,
 *      visible: true
 *    }, {
 *      id: 1,
 *      visible: true
 *    }, {
 *      id: 0,
 *      visible: true,
 *      definitionExpression: "pop2000 > 100000"
 *    }
 *  ]
 * });
 */
export default class MapImageLayer extends MapImageLayerSuperclass {
  /**
   * @deprecated
   * Do not directly reference this property.
   * Use EventNames and EventTypes helpers from \@arcgis/core/Evented
   */
  "@eventTypes": MapImageLayerEvents;
  /**
   * @example
   * // Typical usage
   * let layer = new MapImageLayer({
   *   // URL to the map service
   *   url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",
   *   // dynamic sublayers. See sublayers documentation for more info
   *   sublayers: [ {}, {}, {} ]
   * });
   */
  constructor(properties?: MapImageLayerProperties);
  /**
   * A flat [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of all the [sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#sublayers)
   * in the MapImageLayer including the sublayers of its sublayers.
   * All sublayers are referenced in the order in which they are drawn in the view (bottom to top).
   *
   * @example
   * // finds the census tracts sublayer from a parent sublayer of the
   * // MapImageLayer containing various census sublayers
   * let tractsId = 5;
   * let tracksSublayer = layer.allSublayers.find(function(sublayer){
   *   return sublayer.id === tracksId;
   * });
   */
  readonly allSublayers: Collection<Sublayer>;
  /**
   * The time zone that dates are stored in. This property does not apply to date fields referenced by
   * [timeInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#timeInfo).
   *
   * Even though dates are transmitted as UTC epoch values, this property may be useful when constructing date or time [where clauses for querying](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#date-query).
   * If constructing date or time where clauses, use [FieldsIndex#getTimeZone()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FieldsIndex.html#getTimeZone) to get the
   * time zone for the given date field.
   *
   * @since 4.28
   * @see [Wikipedia - List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
   * @see [Date-time queries | Time zone properties](https://developers.arcgis.com/rest/services-reference/enterprise/query-feature-service-layer/#time-zone-properties)
   */
  get dateFieldsTimeZone(): TimeZone | null | undefined;
  /**
   * This property is set by the service publisher and indicates that dates should be considered without the local timezone.
   * This applies to both requests and responses.
   *
   * > [!WARNING]
   * >
   * > **Known Limitations**
   * >
   * > This capability is only available with services published with ArcGIS Enterprise 10.9 or greater.
   * > When setting `timeExtent` in a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html), [FeatureLayerView#filter](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLayerView.html#filter) or [layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#timeExtent), dates must be defined
   * > in terms of UTC as illustrated in the code below.
   * > When using `layer.timeInfo.fullTimeExtent` in conjunction with [TimeSlider](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider.html), the local timezone offset must be removed. See the code snippet below.
   *
   * @default false
   * @since 4.21
   * @see [ArcGIS REST API - New in 10.9](https://developers.arcgis.com/rest/services-reference/enterprise/layer-table/#new-in-109)
   * @see [What's new in ArcGIS Server](https://enterprise.arcgis.com/en/server/latest/get-started/windows/what-s-new-in-arcgis-for-server.htm)
   * @see [Edit map service settings](https://enterprise.arcgis.com/en/server/latest/publish-services/windows/edit-map-service-settings.htm#LI_A5825E4A9A3A42E991C662CD7B76A860)
   * @example
   * // Only download data for the year 2020.
   * // if the layer supports unknown time zone then create
   * // the dates in UTC
   * if (layer.datesInUnknownTimezone) {
   *   layer.timeExtent = new TimeExtent({
   *     start: new Date(Date.UTC(2020, 0, 1)),
   *     end: new Date(Date.UTC(2021, 0, 1))
   *   });
   * }
   * else {
   *   layer.timeExtent = new TimeExtent({
   *     start: new Date(2020, 0, 1),
   *     end: new Date(2021, 0, 1)
   *   });
   * }
   * @example
   * // set up the timeslider for a service with an unknown timezone
   * if (layer.datesInUnknownTimezone) {
   *   const timeSlider = new TimeSlider({
   *     view: view,
   *     container: "timeSliderDiv",
   *     timeVisible: true,
   *   });
   *   view.ui.add(timeSlider, "bottom-left");
   *
   *   view.whenLayerView(layer).then((layerView) => {
   *    // get the layer's fullTimeExtent and remove the local
   *    // time zone offset
   *     const timExtent = new TimeExtent({
   *       start: removeLocalOffset(layer.timeInfo.fullTimeExtent.start),
   *       end: removeLocalOffset(layer.timeInfo.fullTimeExtent.end)
   *     });
   *
   *     timeSlider.fullTimeExtent = timExtent;
   *     timeSlider.stops = {
   *       interval: layer.timeInfo.interval;
   *     };
   *   });
   * }
   *
   * // Remove the local time zone offset from dates
   * function removeLocalOffset(localTime) {
   *   return new Date(
   *     localTime.getUTCFullYear(),
   *     localTime.getUTCMonth(),
   *     localTime.getUTCDate(),
   *     localTime.getUTCHours(),
   *     localTime.getUTCMinutes(),
   *     localTime.getUTCSeconds(),
   *     localTime.getUTCMilliseconds()
   *   );
   * }
   */
  get datesInUnknownTimezone(): boolean;
  /**
   * The output dots per inch (DPI) of the MapImageLayer.
   *
   * @default 96
   */
  accessor dpi: number;
  /**
   * The version of the geodatabase of the map service data. Read
   * the [Overview of versioning](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/overview-of-versioning-in-arcgis-pro.htm) topic for more details
   * about this capability.
   */
  accessor gdbVersion: string | null | undefined;
  /**
   * The output image type.
   *
   * @default "png24"
   */
  accessor imageFormat: MapImageLayerImageFormat;
  /**
   * Indicates the maximum height of the image exported by the service.
   *
   * @default 2048
   * @since 4.3
   */
  accessor imageMaxHeight: number;
  /**
   * Indicates the maximum width of the image exported by the service.
   *
   * @default 2048
   * @since 4.3
   */
  accessor imageMaxWidth: number;
  /**
   * Indicates whether the background of the image exported by the service is transparent.
   *
   * @default true
   */
  accessor imageTransparency: boolean;
  /**
   * Indicates whether the layer's resources have loaded. When `true`,
   * all the properties of the object can be accessed.
   *
   * @default false
   */
  get loaded(): boolean;
  /**
   * The portal item from which the layer is loaded. This will load the layer
   * along with any overridden properties (e.g. renderers, definition expressions, etc.) saved
   * to the portal item, not the map service.
   *
   * @example
   * let layer = new MapImageLayer({
   *   portalItem: {  // autocasts as new PortalItem()
   *     id: "caa9bd9da1f4487cb4989824053bb847"
   *   }
   * });
   * @example
   * // While this example uses FeatureLayer, this same pattern can be
   * // used for other layers that may be loaded from portalItem ids.
   * const layer = new FeatureLayer({
   *   portalItem: {  // autocasts as new PortalItem()
   *     id: "caa9bd9da1f4487cb4989824053bb847"
   *   }  // the first layer in the service is returned
   * });
   * @example
   * // Set hostname when using an on-premise portal (default is ArcGIS Online)
   * // esriConfig.portalUrl = "http://myHostName.esri.com/arcgis";
   *
   * // While this example uses FeatureLayer, this same pattern can be
   * // used for SceneLayers.
   * const layer = new FeatureLayer({
   *   portalItem: {  // autocasts as new PortalItem()
   *     id: "8d26f04f31f642b6828b7023b84c2188"
   *   },
   *   // loads the third item in the given feature service
   *   layerId: 2
   * });
   * @example
   * // Initialize GeoJSONLayer by referencing a portalItem id pointing to geojson file.
   * const layer = new GeoJSONLayer({
   *   portalItem: new PortalItem({
   *     id: "81e769cd7031482797e1b0768f23c7e1",
   *     // optionally define the portal, of the item.
   *     // if not specified, the default portal defined is used.
   *     // see https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#portalUrl
   *     portal: new Portal({
   *       url: "https://jsapi.maps.arcgis.com/"
   *     })
   *   }
   * });
   * @example
   * // This snippet loads a table hosted in ArcGIS Online.
   * const table = new FeatureLayer({
   *   portalItem: { // autocasts as esri/portal/PortalItem
   *     id: "123f4410054b43d7a0bacc1533ceb8dc"
   *   }
   * });
   *
   * // Before adding the table to the map, it must first be loaded and confirm it is the right type.
   * table.load().then(() => {
   *   if (table.isTable) {
   *     map.tables.add(table);
   *   }
   * });
   * @example
   * // While this example uses FeatureLayer, this same pattern can be
   * // used for other layers that may be loaded from portalItem ids.
   * const layer = new FeatureLayer({
   *   portalItem: { // autocasts as esri/portal/PortalItem
   *     id: "caa9bd9da1f4487cb4989824053bb847",
   *     // Set an API key to access a secure portal item configured with API key authentication.
   *     apiKey: "APIKEY"
   *   }
   * });
   */
  get portalItem(): PortalItem | null | undefined;
  set portalItem(value: PortalItemProperties | null | undefined);
  /**
   * The IANA time zone the author of the service intended data from date fields to be viewed in.
   *
   * @since 4.28
   * @see [Wikipedia - List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
   */
  get preferredTimeZone(): TimeZone | null | undefined;
  /**
   * The [map service's metadata JSON](https://developers.arcgis.com/rest/services-reference/map-service.htm)
   * exposed by the ArcGIS REST API. While most commonly used properties
   * are exposed on the MapImageLayer class directly, this property gives access to all information returned
   * by the map service. This property is useful if working in an application built using an older version of the API
   * which requires access to map service properties from a more recent version.
   *
   * @since 4.13
   */
  accessor sourceJSON: any | null | undefined;
  /**
   * A [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) objects
   * that allow you to alter
   * the properties of one or more sublayers of the MapImageLayer. If this property
   * is not specified, all the sublayers from the service are displayed as defined in the
   * service. If an empty array is passed to this property then none of the sublayers
   * from the service are displayed in the layer.
   *
   * All sublayers are referenced in the order in which they are drawn in the view (bottom to top).
   * They may be [added](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#add),
   * [removed](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#remove), or
   * [reordered](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#reorder) using the
   * [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) methods. Because [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) extends
   * [Accessor](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Accessor.html), its properties may be
   * [watched](https://developers.arcgis.com/javascript/latest/watch-for-changes/#watch-for-changes-in-the-api).
   *
   * @example
   * // Only includes the first sublayer from the map service
   * let layer = new MapImageLayer({
   *   url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",
   *   sublayers: [{
   *     id: 0
   *   }]
   * });
   * @example
   * // toggles the visibility of the first sublayer to false
   * layer.findSublayerById(0).visible = false;
   * @example
   * // sublayers from the service are excluded from the layer
   * layer = new MapImageLayer({
   *   url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",
   *   sublayers: []
   * });
   * @example
   * // Moves the cities sublayer from index 3 to index 0.
   * let citiesLayer = layer.sublayers.at(3);
   * layer.sublayers.reorder(citiesLayer, 0);
   * @example
   * // Overrides the drawing info on the layer with a custom renderer
   * let citiesLayer = layer.sublayers.at(3);
   * citiesLayer.renderer = {
   *   type: "simple",  // autocasts as new SimpleRenderer()
   *   symbol: {
   *     type: "simple-marker",  // autocasts as new SimpleMarkerSymbol()
   *     color: "blue",
   *     size: 3
   *   }
   * };
   */
  get sublayers(): Collection<Sublayer> | null | undefined;
  set sublayers(value: ReadonlyArrayOrCollection<SublayerProperties> | null | undefined);
  /**
   * The title of the layer used to identify it in places such as the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-legend/)
   * and [LayerList](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html).
   *
   * When loading a layer by service url, the title is derived from the service name.
   * The titles for the sublayers will be the same as the names of the sublayers in the service.
   * When the layer is loaded from a portal item, the title of the portal item will be used instead.
   * Finally, if a layer is loaded as part of a webmap or a webscene, then the title of the layer as stored in the webmap/webscene will be used.
   */
  accessor title: string | null | undefined;
  /**
   * The layer type provides a convenient way to check the type of the layer
   * without the need to import specific layer modules.
   */
  get type(): "map-image";
  /**
   * The URL to the REST endpoint of the map service.
   *
   * @example
   * // Layer from Map Service on ArcGIS Server
   * layer.url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer";
   */
  accessor url: string | null | undefined;
  /**
   * Gets the parameters of the exported image to use when calling the
   * [export REST operation](https://developers.arcgis.com/rest/services-reference/export-map.htm).
   *
   * @param extent - The extent of the exported image
   * @param width - The width of the exported image
   * @param height - The height of the exported image
   * @param options - The parameter options is an object with the following properties.
   * @returns The parameters of the exported image. Use this object to call the
   * [export REST operation](https://developers.arcgis.com/rest/services-reference/export-map.htm) against the map service.
   */
  createExportImageParameters(extent: Extent | null | undefined, width: number, height: number, options?: Omit<FetchImageOptions, "signal">): object;
  /**
   * This method fetches the image for the specified extent and size.
   *
   * @param extent - The extent of the view.
   * @param width - The width of the view in pixels.
   * @param height - The height of the view in pixels.
   * @param options - The parameter options is an object with the following properties.
   * @returns Returns a promise that resolves to an
   * [HTMLImageElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement).
   * @example
   * // Fetch an image for the layer from the server for a given extent, height, width.
   * layer.when(function(){
   *   layer.fetchImage(view.extent, view.width, view.height).then(function(result){
   *     imageDiv.appendChild(result);
   *   });
   * });
   */
  fetchImage(extent: Extent, width: number, height: number, options?: FetchImageOptions): Promise<HTMLImageElement>;
  /**
   * Loads all of the sublayers and subtables. See [loaded](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#loaded) or [loadStatus](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#loadStatus)
   * properties to check the status.
   *
   * @returns Resolves when all the loadable resources have been [loaded](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#loaded).
   *   Rejects if at least one of the loadable resources failed to load.
   * @since 4.15
   * @see [load()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#load)
   * @example
   * // Load all resources but ignore if one or more of them failed to load
   * mapImageLayer.loadAll()
   *   .catch(function(error) {
   *     // Ignore any failed resources
   *   })
   *   .then(function() {
   *     console.log("All loaded");
   *   });
   */
  loadAll(): Promise<this>;
  /**
   * Saves the layer to its existing portal item in the [Portal](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html)
   * authenticated within the user's current session. If the layer is not saved to a
   * [PortalItem](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-PortalItem.html), then you should use [saveAs()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#saveAs).
   *
   * > [!WARNING]
   * >
   * > **Known Limitation**
   * >
   * > This method does not support saving cached map services.
   *
   * @param options - Various options for saving the layer.
   * @returns When resolved, returns the portal item to which the layer is saved.
   * @since 4.33
   * @example const portalItem = await layer.save();
   */
  save(options?: SaveOptions): Promise<PortalItem>;
  /**
   * Saves the layer to a new portal item in the [Portal](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html)
   * authenticated within the user's current session.
   *
   * > [!WARNING]
   * >
   * > **Known Limitation**
   * >
   * > This method does not support saving cached map services.
   *
   * @param portalItem - The portal item to which the layer will be saved.
   * @param options - Various options for saving the layer.
   * @returns When resolved, returns the portal item to which the layer is saved.
   * @since 4.33
   * @example
   * const portalItem = new PortalItem();
   * await layer.saveAs(portalItem);
   */
  saveAs(portalItem: PortalItemProperties, options?: SaveAsOptions): Promise<PortalItem>;
}
declare const MapImageLayerSuperclass: typeof Layer & typeof CustomParametersMixin & typeof APIKeyMixin & typeof RefreshableLayer & typeof MultiOriginJSONMixin & typeof PortalLayer & typeof OperationalLayer & typeof ArcGISService & typeof ArcGISMapService & typeof SublayersOwner & typeof ScaleRangeLayer & typeof TemporalLayer & typeof BlendLayer

export type MapImageLayerImageFormat = "png" | "png8" | "png24" | "png32" | "jpg" | "pdf" | "bmp" | "gif" | "pngjpg";