import type Accessor from "../../core/Accessor.js";
import type Collection from "../../core/Collection.js";
import type Extent from "../../geometry/Extent.js";
import type WMSLayer from "../WMSLayer.js";
import type { ReadonlyArrayOrCollection } from "../../core/Collection.js";
import type { IdentifiableMixin, IdentifiableMixinProperties } from "../../core/Identifiable.js";
import type { WMSDimension } from "../wms/types.js";
import type { ExtentProperties } from "../../geometry/Extent.js";

export interface WMSSublayerProperties extends IdentifiableMixinProperties, Partial<Pick<WMSSublayer, "description" | "id" | "layer" | "legendEnabled" | "legendUrl" | "maxScale" | "minScale" | "name" | "parent" | "popupEnabled" | "queryable" | "spatialReferences" | "title" | "visible">> {
  /** The full extent of the layer. */
  fullExtent?: ExtentProperties;
  /** A collection of [WMSSublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-WMSSublayer.html)s. */
  sublayers?: ReadonlyArrayOrCollection<WMSSublayerProperties> | null;
}

/**
 * Represents a sublayer in a [WMSLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WMSLayer.html).
 *
 * @since 4.4
 */
export default class WMSSublayer extends WMSSublayerSuperclass {
  constructor(properties?: WMSSublayerProperties);
  /**
   * Description for the WMS sublayer.
   * This defaults to the value of the Abstract property from the WMS GetCapabilities request.
   */
  accessor description: string;
  /**
   * An array of time, elevation and other dimensions for the sublayer.
   * Information from a {@link layers/support/wmsUtils!TimeDimension} can be used to update [View#timeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#timeExtent),
   * [WMSLayer#timeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WMSLayer.html#timeExtent), or to configure a [TimeSlider](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider.html) widget.
   *
   * A [WMSLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WMSLayer.html) or WMSSublayer can only have one time dimension. The following example shows how to find the
   * time dimension (if any) for the base layer.
   *
   * ```js
   * const layer = new WMSLayer({
   *   url: "https://public-wms.met.no/verportal/verportal.map?request=GetCapabilities&service=WMS&version=1.3.0"
   * });
   * await layer.load();
   * const precipitation = layer.allSublayers.find((sl) => sl.name === "precipitation_3h_global");
   * layer.sublayers = [precipitation];
   * const timeDimension = precipitation.dimensions.find((dimension) => dimension.name === "time");
   * ```
   *
   * Data can exist at specific times or time ranges. We can access this information from the `extent` property of the
   * {@link layers/support/wmsUtils!TimeDimension} as either an array of discrete dates or {@link layers/support/wmsUtils!DimensionInterval}s.
   * For example, continuing from the previous example, a [TimeSlider](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider.html) is configured using the extent from a TimeDimension.
   *
   * ```js
   * const dates = timeDimension.extent; // This time dimension is expressed as an array of dates.
   * const start = dates[0]; // Get the first and earliest date
   * const end = dates[dates.length -1]; // Get last date
   * const timeSlider = new TimeSlider({
   *   container: "timeSliderDiv",
   *   view: view,
   *   mode: "instant",
   *   timeVisible: true,
   *   loop: true,
   *   fullTimeExtent: { // The TimeSlider UI will span all dates
   *     start,
   *     end
   *   },
   *   stops: {
   *     dates // The TimeSlider thumb will snap exactly to each valid date
   *   }
   * })
   *
   * @since 4.20
   */
  get dimensions(): WMSDimension[] | null | undefined;
  /** The full extent of the layer. */
  get fullExtent(): Extent;
  set fullExtent(value: ExtentProperties);
  /** The id for the WMS sublayer. */
  accessor id: number;
  /** The [WMSLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WMSLayer.html) to which the sublayer belongs. */
  accessor layer: WMSLayer | null | undefined;
  /**
   * Indicates whether the layer will be included in the legend. When `false`, the layer will be excluded from the legend.
   *
   * @default true
   */
  accessor legendEnabled: boolean;
  /** A string url pointing to a legend image for the layer. */
  accessor legendUrl: string | null | undefined;
  /**
   * The maximum scale (most zoomed in) at which the layer is visible in the view.
   * If the map is zoomed in beyond this scale, the layer will not be visible.
   * A value of zero means the layer does not have a maximum scale.
   *
   * @default 0
   * @since 4.14
   */
  accessor maxScale: number;
  /**
   * The minimum scale (most zoomed out) at which the layer is visible in the view.
   * If the map is zoomed out beyond this scale, the layer will not be visible.
   * A value of zero means the layer does not have a minimum scale.
   *
   * @default 0
   * @since 4.14
   */
  accessor minScale: number;
  /**
   * Name of the WMS sublayer.
   * This defaults to the value of the Name property from the WMS GetCapabilities request.
   */
  accessor name: string;
  /**
   * Returns a reference to the parent WMS sublayer or layer.
   *
   * @since 4.17
   * @example
   * // Display the title and description for the WMS sublayer named "RADAR_1KM_RDBR".
   * const wmsLayer = new WMSLayer({
   *   url: "https://geo.weather.gc.ca/geomet"
   * });
   * wmsLayer.load().then(() => {
   *   const subLayer = layer.findSublayerByName("RADAR_1KM_RDBR");
   *   let parent = wmsSubLayer.parent;
   *   while(parent) {
   *     parent.visible = true;
   *     parent = parent.parent;
   *   }
   * });
   */
  accessor parent: WMSSublayer | WMSLayer | null | undefined;
  /**
   * Indicates whether to display popups when features in the layer are clicked.
   *
   * @default false
   */
  accessor popupEnabled: boolean;
  /**
   * Indicates if the layer can be queried, i.e. the service supports GetFeatureInfo with either text/html or text/plain formats.
   *
   * @default false
   */
  accessor queryable: boolean;
  /** List of spatialReferences (WKID) derived from the CRS elements of the first layer in the GetCapabilities request. */
  accessor spatialReferences: number[] | null | undefined;
  /** A collection of [WMSSublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-WMSSublayer.html)s. */
  get sublayers(): Collection<WMSSublayer> | null | undefined;
  set sublayers(value: ReadonlyArrayOrCollection<WMSSublayerProperties> | null | undefined);
  /**
   * The title of the WMS sublayer used to identify it in places such as the
   * [LayerList](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html) and [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-legend/).
   * This defaults to the value of the Title property from the WMS GetCapabilities request.
   */
  accessor title: string | null | undefined;
  /** Indicates if the layer is visible in the view. */
  accessor visible: boolean;
  /**
   * Creates a deep clone of the WMS sublayer.
   *
   * @returns A deep clone of the WMS sublayer instance that invoked this method.
   */
  clone(): WMSSublayer;
}
declare const WMSSublayerSuperclass: typeof Accessor & typeof IdentifiableMixin