import type Collection from "../core/Collection.js";
import type BaseElevationLayer from "./BaseElevationLayer.js";
import type ElevationLayer from "./ElevationLayer.js";
import type FeatureLayer from "./FeatureLayer.js";
import type GeoJSONLayer from "./GeoJSONLayer.js";
import type OrientedImageryLayer from "./OrientedImageryLayer.js";
import type SceneLayer from "./SceneLayer.js";
import type SubtypeGroupLayer from "./SubtypeGroupLayer.js";
import type KnowledgeGraphSublayer from "./knowledgeGraph/KnowledgeGraphSublayer.js";
import type DimensionalDefinition from "./support/DimensionalDefinition.js";
import type SubtypeSublayer from "./support/SubtypeSublayer.js";
import type PortalFolder from "../portal/PortalFolder.js";
import type DirectionLine from "../rest/support/DirectionLine.js";
import type DirectionPoint from "../rest/support/DirectionPoint.js";
import type PointBarrier from "../rest/support/PointBarrier.js";
import type PolygonBarrier from "../rest/support/PolygonBarrier.js";
import type PolylineBarrier from "../rest/support/PolylineBarrier.js";
import type RouteInfo from "../rest/support/RouteInfo.js";
import type Stop from "../rest/support/Stop.js";
import type TimeExtent from "../time/TimeExtent.js";
import type { AbortOptions } from "../core/promiseUtils.js";
import type { CurveType } from "../geometry/types.js";
import type { RasterInterpolation } from "./raster/types.js";

export type LayerType = "base-dynamic" | "base-elevation" | "base-tile" | "bing-maps" | "building-scene" | "catalog" | "catalog-footprint" | "catalog-dynamic-group" | "csv" | "dimension" | "elevation" | "feature" | "geo-rss" | "geojson" | "parquet" | "gaussian-splat" | "graphics" | "group" | "imagery" | "imagery-tile" | "integrated-mesh" | "integrated-mesh-3dtiles" | "kml" | "knowledge-graph" | "knowledge-graph-sublayer" | "line-of-sight" | "link-chart" | "map-image" | "map-notes" | "media" | "video" | "ogc-feature" | "open-street-map" | "oriented-imagery" | "point-cloud" | "route" | "scene" | "stream" | "subtype-group" | "tile" | "unknown" | "unsupported" | "vector-tile" | "viewshed" | "voxel" | "wcs" | "web-tile" | "wfs" | "wms" | "wmts";

export type LayerListMode = "show" | "hide" | "hide-children";

export type EditableLayerUnion = FeatureLayer | GeoJSONLayer | OrientedImageryLayer | SceneLayer | SubtypeGroupLayer | KnowledgeGraphSublayer;

export type LayerWithFeatureTemplatesUnion = Exclude<EditableLayerUnion, SubtypeGroupLayer> | SubtypeSublayer | KnowledgeGraphSublayer;

/**
 * Specifies information about editing.
 *
 * @since 4.12
 */
export interface EditingInfo {
  /** Indicates the last time the layer was edited. This value gets updated every time the layer's data is edited or when any of its properties change. */
  lastEditDate?: Date | null;
}

export interface SupportedSpatialAggregationStatistics {
  /** Indicates if the layer can return centroid for each distinct group for [Query#groupByFieldsForStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#groupByFieldsForStatistics). */
  centroid: boolean;
  /** Indicates if the layer can return convex hull for each distinct group for [Query#groupByFieldsForStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#groupByFieldsForStatistics). */
  convexHull: boolean;
  /** Indicates if the layer can return extent for each distinct group for [Query#groupByFieldsForStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#groupByFieldsForStatistics). */
  envelope: boolean;
}

export interface SupportedBinStatistics extends SupportedSpatialAggregationStatistics {
  /** Indicates if the layer supports `avg` statistics function. */
  avg?: boolean;
  /** Indicates if the layer supports `count` statistics function. */
  count?: boolean;
  /** Indicates if the layer supports `max` statistics function. */
  max?: boolean;
  /** Indicates if the layer supports `min` statistics function. */
  min?: boolean;
  /** Indicates if the layer supports `percentileContinuous` statistics function. */
  percentileContinuous?: boolean;
  /** Indicates if the layer supports `percentileDiscrete` statistics function. */
  percentileDiscrete?: boolean;
  /** Indicates if the layer supports `stddev` statistics function. */
  stddev?: boolean;
  /** Indicates if the layer supports `sum` statistics function. */
  sum?: boolean;
  /** Indicates if the layer supports `var` statistics function. */
  var?: boolean;
}

export interface SupportedBinNormalizationTypes {
  /** Indicates if the queryAttributeBins supports field normalization. */
  field?: boolean;
  /** Indicates if the queryAttributeBins supports log normalization. */
  log?: boolean;
  /** Indicates if the queryAttributeBins supports natural log normalization. */
  naturalLog?: boolean;
  /** Indicates if the queryAttributeBins supports percent of total normalization. */
  percentOfTotal?: boolean;
  /** Indicates if the queryAttributeBins supports square root normalization. */
  squareRoot?: boolean;
}

export interface DataCapabilities {
  /** Indicates if the feature service is branch versioned. */
  isBranchVersioned: boolean;
  /** Indicates if the feature service is versioned. */
  isVersioned: boolean;
  /** The types of true curves the layer supports. */
  supportedCurveTypes: readonly CurveType[];
  /** Indicates if the attachment is enabled on the layer. */
  supportsAttachment: boolean;
  /** Indicates if the features in the layer support m-values. */
  supportsM: boolean;
  /** Indicates if the layer supports geometries with true curves. */
  supportsTrueCurve: boolean;
  /**
   * Indicates if the features in the layer support z-values.
   * See [FeatureLayer#elevationInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#elevationInfo) for details regarding placement and rendering of features with z-values in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
   */
  supportsZ: boolean;
}

export interface MetadataCapabilities {
  /**
   * Indicates whether to provide a user-defined field description.
   * See [Describe attribute fields](https://doc.arcgis.com/en/arcgis-online/manage-data/describe-fields.htm) for additional information.
   */
  supportsAdvancedFieldProperties: boolean;
}

export interface OperationCapabilities {
  /** Indicates if new features can be [added](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits) to the layer. */
  supportsAdd: boolean;
  /**
   * Indicates if values of one or more field values in the layer can be updated.
   * See the [Calculate REST operation](https://developers.arcgis.com/rest/services-reference/calculate-feature-service-layer-.htm) document for more information.
   */
  supportsCalculate: boolean;
  /** Indicates if features can be [deleted](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits) from the layer. */
  supportsDelete: boolean;
  /**
   * Indicates if features in the layer can be [edited](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits).
   *  Use `supportsAdd`, `supportsUpdate` and `supportsDelete` to determine which editing operations are supported.
   */
  supportsEditing: boolean;
  /** Indicates if features in the layer can be [queried](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryFeatures). */
  supportsQuery: boolean;
  /**
   * Indicates if the layer supports
   * [REST API queryAttachments](https://developers.arcgis.com/rest/services-reference/query-attachments-feature-service-layer-.htm) operation.
   * If `false`, [queryAttachments() method](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#queryAttachments) can only return attachments for one feature at a time.
   * If `true`, `queryAttachments()` can return attachments for array of [AttachmentQuery#objectIds](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttachmentQuery.html#objectIds).
   */
  supportsQueryAttachments: boolean;
  /**
   * Indicates if the layer supports
   * [REST API queryTopFeatures](https://developers.arcgis.com/rest/services-reference/enterprise/query-top-features-feature-service-layer-.htm) operation.
   */
  supportsQueryTopFeatures: boolean;
  /**
   * Deprecated since 4.24. Use `attachment.supportsResize` instead. Indicates if resized attachments are supported in the feature layer.
   * This is useful for showing thumbnails in [Popups](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html).
   */
  supportsResizeAttachments: boolean;
  /** Indicates if features in the layer can be [updated](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits). */
  supportsUpdate: boolean;
  /** Indicates if the layer supports a SQL-92 expression or where clause. */
  supportsValidateSql: boolean;
}

export interface QueryCapabilities {
  /** The maximum number of records that will be returned for a given query. */
  maxRecordCount?: number | null;
  /** The maximum number of unique-ids that will be returned for a given query. */
  maxUniqueIDCount?: number | null;
  /** List of supported aggregated geometries returned for each distinct group when [Query#groupByFieldsForStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#groupByFieldsForStatistics) is used. */
  supportedSpatialAggregationStatistics: SupportedSpatialAggregationStatistics;
  /**
   * Indicates if the query operation supports a [cache hint](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#cacheHint). This is valid only for
   * [hosted feature services](https://doc.arcgis.com/en/arcgis-online/share-maps/hosted-web-layers.htm).
   */
  supportsCacheHint: boolean;
  /**
   * Indicates if the geometry centroid associated with each polygon feature can be returned. This operation is
   * only supported in ArcGIS Online hosted feature services.
   */
  supportsCentroid: boolean;
  /**
   * Indicates if the query operation supports `disjoint` [spatial relationship](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#spatialRelationship). This is valid only for
   * [hosted feature services](https://doc.arcgis.com/en/arcgis-online/share-maps/hosted-web-layers.htm).
   */
  supportsDisjointSpatialRelationship: boolean;
  /** Indicates if the layer's query operation supports a buffer distance for input geometries. */
  supportsDistance: boolean;
  /** Indicates if the layer supports queries for distinct values based on fields specified in the [FeatureLayer#outFields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#outFields). */
  supportsDistinct: boolean;
  /**
   * Indicates if the layer's query response includes the extent of features.
   * At 10.3, this option is only available for hosted feature services. At 10.3.1, it is available for hosted and non-hosted feature services.
   */
  supportsExtent: boolean;
  /**
   * Indicates if the layer's query response contains geometry attributes, including shape area and length attributes.
   * This operation is supported in ArcGIS Online hosted feature services created since December 2016 and ArcGIS Enterprise feature services since version 10.7.
   */
  supportsGeometryProperties: boolean;
  /** Indicates if the layer supports the [Query#having](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#having) clause on the service. Requires an ArcGIS Server service 10.6.1 or greater. */
  supportsHavingClause: boolean;
  /** Indicates if the layer supports historic moment query. Requires ArcGIS Server service 10.5 or greater. */
  supportsHistoricMoment: boolean;
  /** Indicates if the layer supports [Query#maxRecordCountFactor](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#maxRecordCountFactor) on the service. */
  supportsMaxRecordCountFactor: boolean;
  /** Indicates if the query response can be ordered by one or more fields. Requires an ArcGIS Server service 10.3 or greater. */
  supportsOrderBy: boolean;
  /** Indicates if the query response supports pagination. Requires an ArcGIS Server service 10.3 or greater. */
  supportsPagination: boolean;
  /** Indicates if the layer supports [percentile statisticType](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-StatisticDefinition.html#statisticType). Requires an ArcGIS Server service 10.7 or greater. */
  supportsPercentileStatistics: boolean;
  /** Indicates if the query operation supports the projection of geometries onto a virtual grid. Requires an ArcGIS Server service 10.6.1 or greater. */
  supportsQuantization: boolean;
  /** Indicates if the query operation supports quantization designed to be used in edit mode (highest resolution at the given spatial reference). Requires an ArcGIS Server service 10.6.1 or greater. */
  supportsQuantizationEditMode: boolean;
  /**
   * Indicates if the query response includes the [query geometry](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-FeatureSet.html#queryGeometry). This is valid only for
   * [hosted feature services](https://doc.arcgis.com/en/arcgis-online/share-maps/hosted-web-layers.htm).
   */
  supportsQueryGeometry: boolean;
  /** Indicates if the number of features returned by the query operation can be controlled. */
  supportsResultType: boolean;
  /** Indicates if queries support returning [Mesh](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Mesh.html) geometries. This is true for scene layers backed by a 3D Object feature layer. */
  supportsReturnMesh: boolean;
  /**
   * Indicates if the layer supports spatial extent, center or convex hull to be returned for each distinct group when
   * [Query#groupByFieldsForStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#groupByFieldsForStatistics) is used. Supported with ArcGIS Online hosted features services only.
   */
  supportsSpatialAggregationStatistics: boolean;
  /** Indicates if the query operation supports SQL expressions. */
  supportsSqlExpression: boolean;
  /**
   * Indicates if the query operation supports using standardized queries.
   * Learn more about [standardized queries here](https://enterprise.arcgis.com/en/server/latest/administer/linux/about-standardized-queries.htm).
   */
  supportsStandardizedQueriesOnly: boolean;
  /** Indicates if the layer supports field-based statistical functions. Requires ArcGIS Server service 10.1 or greater. */
  supportsStatistics: boolean;
  /**
   * Indicates if the layer supports geometries with true curves.
   *
   * @deprecated since 5.0. Use `data.supportsTrueCurve` instead.
   */
  supportsTrueCurve: boolean;
}

export interface QueryRelatedCapabilities {
  /**
   * Indicates if the [relationship query operation](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-RelationshipQuery.html) supports a cache hint. This is valid only for
   * [hosted feature services](https://doc.arcgis.com/en/arcgis-online/share-maps/hosted-web-layers.htm).
   */
  supportsCacheHint: boolean;
  /** Indicates if the layer's query response includes the number of features or records related to features in the layer. */
  supportsCount: boolean;
  /** Indicates if the related features or records returned in the query response can be ordered by one or more fields. */
  supportsOrderBy: boolean;
  /** Indicates if the query response supports pagination for related features or records. */
  supportsPagination: boolean;
}

export interface EditingCapabilities {
  /** Indicates if anonymous users can delete features created by others. */
  supportsDeleteByAnonymous: boolean;
  /** Indicates if logged in users can delete features created by others. */
  supportsDeleteByOthers: boolean;
  /** Indicates if the geometry of the features in the layer can be edited. */
  supportsGeometryUpdate: boolean;
  /** Indicates if the `globalId` values provided by the client are used in [FeatureLayer#applyEdits()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits). */
  supportsGlobalId: boolean;
  /** Indicates if the `rollbackOnFailureEnabled` parameter can be set to `true` or `false` when editing features. */
  supportsRollbackOnFailure: boolean;
  /** Indicates if feature geometries containing true curves can be updated. */
  supportsTrueCurveUpdate: boolean;
  /**
   * Indicates whether updates to true curves should be restricted to clients
   * that support true editing. If `true`, `applyEdits` calls that update true
   * curves must have the `trueCurveClient` parameter set to `true`.
   */
  supportsTrueCurveUpdateByTrueCurveClientsOnly: boolean;
  /** Indicates if anonymous users can update features created by others. */
  supportsUpdateByAnonymous: boolean;
  /** Indicates if logged in users can update features created by others. */
  supportsUpdateByOthers: boolean;
  /** Indicates if `m-values` must be provided when updating features. */
  supportsUpdateWithoutM: boolean;
  /** Indicates if the layer supports uploading attachments by [UploadId](https://developers.arcgis.com/rest/services-reference/item.htm). */
  supportsUploadWithItemId: boolean;
}

export interface AttachmentCapabilities {
  /**
   * Indicates if the [attachment operations](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttachmentQuery.html) support a cache hint. This is valid only for
   * [hosted feature services](https://doc.arcgis.com/en/arcgis-online/share-maps/hosted-web-layers.htm).
   */
  supportsCacheHint: boolean;
  /** Indicates if the attachments can be [queried](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttachmentQuery.html) by their content types. */
  supportsContentType: boolean;
  /** Indicates if the attachment [queries](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttachmentQuery.html) support `exifInfo`. */
  supportsExifInfo: boolean;
  /** Indicates if the attachments can be [queried](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttachmentQuery.html) by their keywords. */
  supportsKeywords: boolean;
  /** Indicates if the attachments can be [queried](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttachmentQuery.html) by their names. */
  supportsName: boolean;
  /** **Since 4.32.** Indicates if the [queried](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttachmentQuery.html) attachments can be returned in [order](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttachmentQuery.html#orderByFields) based on the specified `attachmentInfo` fields. */
  supportsOrderByFields: boolean;
  /**
   * Indicates if resized attachments are supported in the feature layer.
   * This is useful for showing thumbnails in [Popups](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html). See the feature service [Attachment](https://developers.arcgis.com/rest/services-reference/enterprise/attachment-feature-service/) documentation for information on services that support resizing.
   */
  supportsResize: boolean;
  /** Indicates if the attachments can be [queried](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttachmentQuery.html) by their sizes. */
  supportsSize: boolean;
  /** **Since 4.34.** Indicates if the attachments can be [queried](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttachmentQuery.html) by using a wildcard character for attachment types. */
  supportsTypeWildcard: boolean;
}

export interface AnalyticsCapabilities {
  /** Indicates if the feature service supports cache hint. */
  supportsCacheHint: boolean;
}

export interface QueryTopFeaturesCapabilities {
  /**
   * Indicates if the [top query operation](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-TopFeaturesQuery.html) supports a cache hint. This is valid only for
   * [hosted feature services](https://doc.arcgis.com/en/arcgis-online/share-maps/hosted-web-layers.htm).
   */
  supportsCacheHint: boolean;
}

export interface QueryBinsCapabilities {
  /** Normalization types supported by the queryBins operation. */
  supportedNormalizationTypes?: SupportedBinNormalizationTypes | null;
  /** Indicates if the layer supports [statistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttributeBinsQuery.html#outStatistics) attribute bins query functions. */
  supportedStatistics?: SupportedBinStatistics | null;
  /** Indicates if the layer supports [auto interval](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AutoIntervalBinParameters.html) attribute bins query functions. */
  supportsAutoInterval: boolean;
  /** Indicates if the layer supports [date field-based](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-DateBinParameters.html) attribute bins query functions. */
  supportsDate: boolean;
  /** Indicates if the first day of the week can be set for date binning. */
  supportsFirstDayOfWeek: boolean;
  /** Indicates if the layer supports [fixed boundaries](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-FixedBoundariesBinParameters.html) attribute bins query functions. */
  supportsFixedBoundaries: boolean;
  /** Indicates if the layer supports [fixed interval](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-FixedIntervalBinParameters.html) attribute bins query functions. */
  supportsFixedInterval: boolean;
  /** Indicates if data can be transformed. */
  supportsNormalization: boolean;
  /** When `true` all bins have equal intervals. When `false` the last bin's upper boundary maybe adjusted to the maximum value in the dataset. */
  supportsReturnFullIntervalBin: boolean;
  /** Indicates if the layer's [date field-based](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-DateBinParameters.html) binning supports snapping data to either the first or last date point. */
  supportsSnapToData: boolean;
  /** Indicates if the layer supports the `splitBy` parameter in attribute bins query functions. */
  supportsSplitBy: boolean;
  /** Indicates if the layer supports the `stackBy` parameter in attribute bins query functions. */
  supportsStackBy: boolean;
}

/** Describes the layer's supported capabilities. */
export interface FeatureLayerCapabilities {
  /** Describes what analytics capabilities are enabled on the layer. */
  analytics: AnalyticsCapabilities;
  /** Describes what attachment capabilities are enabled on the layer. */
  attachment?: AttachmentCapabilities | null;
  /** Describes characteristics of the data in the layer. */
  data: DataCapabilities;
  /** Describes editing capabilities that can be performed on the features in the layer via [FeatureLayer#applyEdits()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits). */
  editing: EditingCapabilities;
  /** Describes the metadata contained on features in the layer. */
  metadata: MetadataCapabilities;
  /** Describes operations that can be performed on features in the layer. */
  operations: OperationCapabilities;
  /**
   * Describes [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html)
   * operations that can be performed on features in the layer.
   */
  query: QueryCapabilities;
  /** _Since 4.32_ Describes [AttributeBinsQuery](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-AttributeBinsQuery.html) operations that can be performed on features in the layer. */
  queryAttributeBins: QueryBinsCapabilities;
  /** Indicates if the layer's query operation supports querying features or records related to features in the layer. */
  queryRelated: QueryRelatedCapabilities;
  /** Describes [top features query](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-TopFeaturesQuery.html) operations that can be performed on features in the layer. */
  queryTopFeatures: QueryTopFeaturesCapabilities;
}

export interface VideoLayerCapabilities {
  /** The operations capabilities of the video layer. */
  operations: VideoLayerCapabilitiesOperations;
}

export interface VideoLayerCapabilitiesOperations {
  /** Indicates if the video layer supports appending data. */
  supportsAppend: boolean;
  /** Indicates if the video layer supports coverage queries. */
  supportsCoverageQuery: boolean;
  /** Indicates if the video layer supports exporting clips. */
  supportsExportClip: boolean;
  /** Indicates if the video layer supports exporting frames. */
  supportsExportFrameset: boolean;
  /** Indicates if the video layer supports mensuration. */
  supportsMensuration: boolean;
  /** Indicates if the video layer supports display of frame previews. */
  supportsPreviews: boolean;
  /** Indicates if the video layer supports updating data. */
  supportsUpdate: boolean;
}

export interface VectorTileLayerCapabilities {
  /** Indicates options supported by the exportTiles operation. Will be `null` if the `supportsExportTiles` is `false`. */
  exportTiles?: VectorTileLayerCapabilitiesExportTiles | null;
  /** Indicates operations that can be performed on the service. */
  operations: VectorTileLayerCapabilitiesOperations;
}

export interface VectorTileLayerCapabilitiesOperations {
  /** Indicates if the tiles from the service can be exported. */
  supportsExportTiles: boolean;
  /** -Indicates if the service exposes a tile map that describes the presence of tiles. */
  supportsTileMap: boolean;
}

export interface VectorTileLayerCapabilitiesExportTiles {
  /** Specifies the maximum number of tiles that can be exported to a cache dataset or a tile package. */
  maxExportTilesCount: number;
}

export interface FetchRasterOptions extends AbortOptions {
  /** Returns pixel data only for the specified bands, if provided. Added at version 4.34. */
  bandIds?: number[] | null;
  /** Added at version 4.23. Defines how to interpolate pixel values. */
  interpolation?: RasterInterpolation;
}

export interface DynamicFetchRasterOptions extends AbortOptions {
  /**
   * When `true`, request a rendered image from server using layer's rendering configuration, including
   * layer format (jpgpng or similar), renderer, bandIds, compression quality and interpolation setting.
   */
  applyRendering?: boolean;
  /** Returns pixel data only for the specified bands, if provided. Added at version 4.34. */
  bandIds?: number[];
  /** Defines how to interpolate pixel values. */
  interpolation?: RasterInterpolation;
}

/**
 * Additional options to set for `identify()` method on [ImageryTileLayer#identify()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryTileLayer.html#identify) and [WCSLayer#identify()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WCSLayer.html#identify).
 *
 * At version 4.25, the `transposedVariableName` was added to get pixel values from specific dimensional definitions if the [ImageryTileLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryTileLayer.html)
 * references a [transposed multidimensional](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-RasterInfo.html#hasMultidimensionalTranspose) image service.
 * Set the `transposedVariableName` and `multidimensionalDefinition` get pixel values for the specified dimensional definitions from a transposed multidimensional service.
 * If `multidimensionalDefinition` is not specified, pixel values will be returned from all the dimensional slices.
 */
export interface RasterIdentifyOptions extends AbortOptions {
  /**
   * A dimensional definition used for the `identify` operation.
   * For non-transposed multidimensional [ImageryTileLayer#identify()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryTileLayer.html#identify) and for [WCSLayer#identify()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WCSLayer.html#identify), the identify
   * operation returns a value for only one dimensional slice at a time.
   * For transposed multidimensional [ImageryTileLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryTileLayer.html), identify returns values for all or specified dimensional slices.
   */
  multidimensionalDefinition?: DimensionalDefinition[] | null;
  /**
   * Name of the transposed variable. This option is only honored if the ImageryTileLayer's
   * [serviceRasterInfo.hasMultidimensionalTranspose](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-RasterInfo.html#hasMultidimensionalTranspose) is `true`. Added since 4.25.
   */
  transposedVariableName?: string;
}

export interface FetchImageOptions extends AbortOptions {
  /** The ratio of the resolution in physical pixels of the image to the resolution it will be displayed at. */
  pixelRatio?: number | null;
  /** The rotation in degrees of the exported image. Available since ArcGIS Server 10.3. */
  rotation?: number | null;
  /** The time instant or time extent of content to render. */
  timeExtent?: TimeExtent | null;
}

/** Describes the layer's supported capabilities. */
export interface SceneLayerCapabilities {
  /** Describes characteristics of the data in the layer. */
  data: SceneLayerCapabilitiesData;
  /** Describes editing capabilities that can be performed on the features in the layer via [SceneLayer#applyEdits()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#applyEdits). */
  editing: SceneLayerCapabilitiesEditing;
  /** Describes operations that can be performed on features in the layer. */
  operations: SceneLayerCapabilitiesOperations;
  /**
   * Describes [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html)
   * operations that can be performed on features in the layer.
   */
  query: FeatureLayerCapabilities["query"];
  /** Indicates if the layer's query operation supports querying features or records related to features in the layer. */
  queryRelated: FeatureLayerCapabilities["queryRelated"];
}

export type SceneLayerCapabilitiesData = Pick<FeatureLayerCapabilities["data"], "supportsZ" | "supportsM" | "isVersioned" | "supportsAttachment">;

export type SceneLayerCapabilitiesEditing = Pick<FeatureLayerCapabilities["editing"], "supportsGlobalId" | "supportsGeometryUpdate" | "supportsRollbackOnFailure" | "supportsUploadWithItemId">;

export type SceneLayerCapabilitiesOperations = Pick<FeatureLayerCapabilities["operations"], "supportsQuery" | "supportsQueryAttachments" | "supportsAdd" | "supportsDelete" | "supportsEditing" | "supportsUpdate">;

/** The results of computing a route and directions. */
export interface RouteLayerSolveResult {
  /** Collection of direction polylines associated with line segments between turns. */
  directionLines: Collection<DirectionLine>;
  /** Collection of direction items as points with various display information. */
  directionPoints: Collection<DirectionPoint>;
  /** Point barrier(s) to restrict travel along a street network when using a [RouteLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html). */
  pointBarriers: Collection<PointBarrier>;
  /** Polygon barrier(s) to restrict travel along a street network when using a [RouteLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html). */
  polygonBarriers: Collection<PolygonBarrier>;
  /** Polyline barrier(s) to restrict travel along a street network when using a [RouteLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html). */
  polylineBarriers: Collection<PolylineBarrier>;
  /** Information about a solved route including the route's geometry and overall distance and time. */
  routeInfo: RouteInfo;
  /** Represents the start, end, or midpoint of a route created using the [RouteLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html). */
  stops: Collection<Stop>;
}

export type BlendMode = "average" | "color-burn" | "color-dodge" | "color" | "darken" | "destination-atop" | "destination-in" | "destination-out" | "destination-over" | "difference" | "exclusion" | "hard-light" | "hue" | "invert" | "lighten" | "lighter" | "luminosity" | "minus" | "multiply" | "normal" | "overlay" | "plus" | "reflect" | "saturation" | "screen" | "soft-light" | "source-atop" | "source-in" | "source-out" | "vivid-light" | "xor";

export type GroundElevationLayerUnion = ElevationLayer | BaseElevationLayer;

export interface LayerSaveOptions {
  /** Indicates whether to ignore saving unsupported layers or layers with unsupported content, such as unsupported symbology. */
  ignoreUnsupported?: boolean;
}

export interface LayerSaveAsOptions extends LayerSaveOptions {
  /** The portal folder where the layer's portal item will be saved. */
  folder?: PortalFolder;
}