import type Graphic from "../Graphic.js";
import type Collection from "../core/Collection.js";
import type Extent from "../geometry/Extent.js";
import type Layer from "./Layer.js";
import type Field from "./support/Field.js";
import type SubtypeSublayer from "./support/SubtypeSublayer.js";
import type PortalItem from "../portal/PortalItem.js";
import type AttachmentInfo from "../rest/query/support/AttachmentInfo.js";
import type FeatureSet from "../rest/support/FeatureSet.js";
import type Query from "../rest/support/Query.js";
import type { ClonableMixin } from "../core/Clonable.js";
import type { MultiOriginJSONSupportMixin } from "../core/MultiOriginJSONSupport.js";
import type { EditOptions, Edits, EditsResult, FeatureEditResult } from "../editing/types.js";
import type { LayerEvents, LayerProperties } from "./Layer.js";
import type { LayerSaveAsOptions, LayerSaveOptions } from "./types.js";
import type { APIKeyMixin, APIKeyMixinProperties } from "./mixins/APIKeyMixin.js";
import type { BlendLayer, BlendLayerProperties } from "./mixins/BlendLayer.js";
import type { CustomParametersMixin, CustomParametersMixinProperties } from "./mixins/CustomParametersMixin.js";
import type { DisplayFilteredLayer, DisplayFilteredLayerProperties } from "./mixins/DisplayFilteredLayer.js";
import type { EditBusLayer, EditBusLayerEvents } from "./mixins/EditBusLayer.js";
import type { FeatureLayerBase, FeatureLayerBaseProperties } from "./mixins/FeatureLayerBase.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 { TemporalLayer, TemporalLayerProperties } from "./mixins/TemporalLayer.js";
import type { PortalItemProperties } from "../portal/PortalItem.js";
import type { RequestOptions } from "../request/types.js";
import type { AttachmentQueryProperties } from "../rest/support/AttachmentQuery.js";
import type { QueryProperties } from "../rest/support/Query.js";
import type { RelationshipQueryProperties } from "../rest/support/RelationshipQuery.js";
import type { SubtypeSublayerProperties } from "./support/SubtypeSublayer.js";
import type { ReadonlyArrayOrCollection } from "../core/Collection.js";

export interface SubtypeGroupLayerProperties extends LayerProperties, APIKeyMixinProperties, CustomParametersMixinProperties, PortalLayerProperties, OperationalLayerProperties, RefreshableLayerProperties, ScaleRangeLayerProperties, TemporalLayerProperties, BlendLayerProperties, DisplayFilteredLayerProperties, FeatureLayerBaseProperties, Partial<Pick<SubtypeGroupLayer, "outFields">> {
  /**
   * A [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) of [SubtypeSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/) objects that allow
   * you to alter the properties of one or more sublayers of the SubtypeGroupLayer.
   * If this property is not specified, all the sublayers from the feature service are displayed as defined in the service.
   *
   * All sublayers must be referenced using the [SubtypeSublayer.subtypeCode](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/#subtypeCode) to identify the sublayer. The sublayers may be [added](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/#add),
   * [removed](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/#remove), or
   * [reordered](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/#reorder) using the
   * [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) methods. Because [Sublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/) extends
   * [Accessor](https://developers.arcgis.com/javascript/latest/references/core/core/Accessor/), 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 SubtypeSublayer from the SubtypeGroupLayer
   * let layer = new SuptypeGroupLayer({
   *   url: "https://sampleserver7.arcgisonline.com/server/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer/0",
   *   sublayers: [{
   *     subtypeCode: 0,
   *     visible: true,
   *     renderer: {
   *       type: "simple",
   *       symbol: {
   *         type: "simple-marker",
   *         style: "circle",
   *         color: [120, 120, 120, 255],
   *         size: 6
   *       }
   *     }
   *   }]
   * });
   */
  sublayers?: ReadonlyArrayOrCollection<SubtypeSublayerProperties>;
}

export interface SubtypeGroupLayerEvents extends EditBusLayerEvents, LayerEvents, RefreshableLayerEvents {}

/**
 * ## Overview
 *
 * The SubtypeGroupLayer is a single layer that automatically creates a [SubtypeSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/) for
 * each subtype in its corresponding [feature service](https://enterprise.arcgis.com/en/server/latest/publish-services/windows/what-is-a-feature-service-.htm). This allows for each
 * subtype to have its own configured layer properties, and as a result, each sublayer can visualize its feature data with a distinct visibility,
 * renderer, and popup properties. This allows for interaction of the sublayers as if they were individual layers, when in reality, they all share the same feature source.
 *
 * The SubtypeGroupLayer takes advantage of the fact that all of its [sublayers](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#sublayers) share a single feature service in order to draw more efficiently, and optimize
 * its queries across all sublayers. For instance, a single request is sent when panning or zooming in the [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/), keeping in mind that each sublayer can have its own renderer.
 * This approach eliminates the need to require multiple feature layers to be
 * published. This would result in each feature layer sending its own request when panning and zooming the map.
 *
 * The SubtypeGroupLayer will be useful for data, such as the utility network datasets, which currently contain feature layers with numerous subtypes.
 *
 * ## Creating a SubtypeGroupLayer
 *
 * A SubtypeGroupLayer can be created from a [service URL](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#url), or an ArcGIS portal [item id](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#portalItem).
 *
 * > [!WARNING]
 * >
 * > **Note**
 * >
 * > The feature service must be published with subtypes to use the `SubtypeGroupLayer`. To learn more about publishing a feature service with subtypes and how to create a subtype group layer using ArcGIS Pro, please read the following documentation:
 * > - [Introduction to subtypes](https://pro.arcgis.com/en/pro-app/2.8/help/data/geodatabases/overview/an-overview-of-subtypes.htm)
 * > - [Subtype group layers](https://pro.arcgis.com/en/pro-app/latest/help/mapping/layer-properties/subtype-layers.htm#GUID-0CC6ED6A-15B2-4F96-9CB6-0D108D5D37C5).
 *
 * ### Reference a service URL
 *
 * To create a SubtypeGroupLayer instance from a service, you must set the [url](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#url) property to the REST endpoint of
 * a layer in a feature service. The feature service must have a [subtype field](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#subtypeField), otherwise the layer will fail to load.
 *
 * ```js
 * const SubtypeGroupLayer = await $arcgis.import("@arcgis/core/layers/SubtypeGroupLayer.js");
 * const stgl = new SubtypeGroupLayer({
 *   url: "https://sampleserver7.arcgisonline.com/server/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer/0"
 * });
 * map.add(stgl);  // adds the layer to the map
 * ```
 *
 * ### Reference an ArcGIS portal Item ID
 *
 * You can also create a SubtypeGroupLayer from its [portalItem](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#portalItem) property if it exists as an item in ArcGIS Online
 * or ArcGIS Enterprise.
 *
 * ```js
 * const stgl = new SubtypeGroupLayer({
 *   portalItem: {  // autocasts as esri/portal/PortalItem
 *     id: "8444e275037549c1acab02d2626daae"
 *   }
 * });
 * map.add(stgl);
 * ```
 *
 * ## Sublayers
 *
 * The [sublayers](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#sublayers) of the SubtypeGroupLayer are known as [SubtypeSublayers](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/).
 * These sublayers do not correspond to individual services, but rather are created dynamically by the SubtypeGroupLayer. Each
 * sublayer corresponds to a subtype in the SubtypeGroupLayer feature service. One can configure each layer's properties including the
 * renderer and popup. The sublayers' layer properties can be defined via the [sublayers](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#sublayers) property. The following demonstrates
 * an example of configuring the layer properties of the sublayers.
 *
 * ```js
 * const stgl = new SubtypeGroupLayer({
 *   url: "https://sampleserver7.arcgisonline.com/server/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer/0",
 *   sublayers: [ // autocasts as a Collection of SubtypeSublayers
 *     {
 *       subtypeCode: 12,
 *       visible: true,
 *       renderer: simpleRenderer
 *     },
 *     {
 *       subtypeCode: 14,
 *       visible: false,
 *       renderer: classBreaksRenderer
 *     },
 *     {
 *       subtypeCode: 16,
 *       visible: true,
 *       renderer: classBreaksRenderer,
 *       popupTemplate: popupTemplate
 *     }
 *   ]
 * });
 * map.add(stgl);
 * ```
 *
 * ## Data Visualization
 * Features in a SubtypeGroupLayer are visualized by setting a [Renderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/Renderer/) to the
 * [SubtypeSublayer.renderer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/#renderer) property of each sublayer. Features may be visualized with the same symbol using
 * [SimpleRenderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/SimpleRenderer/), by type with [UniqueValueRenderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/UniqueValueRenderer/), or
 * with class breaks using [ClassBreaksRenderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/ClassBreaksRenderer/).
 *
 * > [!WARNING]
 * >
 * > **Known Limitations**
 * >
 * > SubtypeGroupLayer is only supported in 2D [MapViews](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/).
 * > [Clustering](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionCluster/) is currently not supported.
 * > [DotDensityRenderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/DotDensityRenderer/) is currently not supported.
 *
 * @since 4.20
 * @see [SubtypeSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/)
 * @see [Sample - Intro to SubtypeGroupLayer](https://developers.arcgis.com/javascript/latest/sample-code/layers-subtypegrouplayer/)
 * @see [How to use the SubtypeGroupLayer with the ArcGIS Maps SDK for JavaScript](https://www.esri.com/arcgis-blog/products/js-api-arcgis/developers/subtypegrouplayer-with-arcgis-api-for-javascript/)
 * @see [Subtype group layers](https://pro.arcgis.com/en/pro-app/latest/help/mapping/layer-properties/subtype-layers.htm)
 */
export default class SubtypeGroupLayer extends SubtypeGroupLayerSuperclass {
  /**
   * @deprecated
   * Do not directly reference this property.
   * Use EventNames and EventTypes helpers from \@arcgis/core/Evented
   */
  "@eventTypes": SubtypeGroupLayerEvents;
  constructor(properties?: SubtypeGroupLayerProperties);
  /**
   * Determines if the layer is editable.
   *
   * @default true
   * @see [applyEdits()](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#applyEdits)
   */
  get editingEnabled(): boolean;
  /**
   * An array of fields in the layer. Each field represents an attribute
   * that may contain a value for each feature in the layer. For example,
   * a field named `POP_2015`, stores information about total population as a
   * numeric value for each feature; this value represents the total number
   * of people living within the geographic bounds of the feature.
   *
   * @example
   * // define each field's schema
   * const fields = [
   *  new Field({
   *    name: "ObjectID",
   *    alias: "ObjectID",
   *    type: "oid"
   *  }), new Field({
   *    name: "description",
   *    alias: "Description",
   *    type: "string"
   *  }), new Field ({
   *    name: "title",
   *    alias: "Title",
   *    type: "string"
   *  })
   * ];
   *
   * // See the sample snippet for the source property
   * const layer = new SubtypeSublayer({
   *   // Object ID field is inferred from the fields array
   *   fields: fields
   * });
   */
  get fields(): Field[];
  /**
   * An array of field names from the service to include with each feature.
   * To fetch the values from all fields in the layer, use `["*"]`. Fields specified in
   * `outFields` will be requested alongside with required fields for rendering,
   * and setting the [elevation info](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#elevationInfo) for the layer.
   * The required fields and `outFields` are used to populate
   * [FeatureLikeLayerView.availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLikeLayerView/#availableFields).
   * Set this property to include the fields that will be used for client-side
   * [queries](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLikeLayerView/#queryFeatures)
   * if the fields are not part of required fields used for rendering.
   *
   * @see [fieldUtils](https://developers.arcgis.com/javascript/latest/references/core/layers/support/fieldUtils/)
   * @example
   * // Includes all fields from the service in the layer
   * fl.outFields = ["*"];
   * @example
   * // Get the specified fields from the service in the layer
   * // These fields will be added to SubtypeGroupLayerView.availableFields
   * // along with rendering and labeling fields. Use these fields
   * // for client-side filtering and querying.
   * fl.outFields = ["NAME", "POP_2010", "FIPS", "AREA"];
   * @example
   * // set the outFields for the layer coming from webmap
   * webmap.when(function () {
   *   layer = webmap.layers.at(1);
   *   layer.outFields = ["*"];
   * });
   */
  accessor outFields: string[] | null | undefined;
  /**
   * A [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) of [SubtypeSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/) objects that allow
   * you to alter the properties of one or more sublayers of the SubtypeGroupLayer.
   * If this property is not specified, all the sublayers from the feature service are displayed as defined in the service.
   *
   * All sublayers must be referenced using the [SubtypeSublayer.subtypeCode](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/#subtypeCode) to identify the sublayer. The sublayers may be [added](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/#add),
   * [removed](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/#remove), or
   * [reordered](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/#reorder) using the
   * [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) methods. Because [Sublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/) extends
   * [Accessor](https://developers.arcgis.com/javascript/latest/references/core/core/Accessor/), 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 SubtypeSublayer from the SubtypeGroupLayer
   * let layer = new SuptypeGroupLayer({
   *   url: "https://sampleserver7.arcgisonline.com/server/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer/0",
   *   sublayers: [{
   *     subtypeCode: 0,
   *     visible: true,
   *     renderer: {
   *       type: "simple",
   *       symbol: {
   *         type: "simple-marker",
   *         style: "circle",
   *         color: [120, 120, 120, 255],
   *         size: 6
   *       }
   *     }
   *   }]
   * });
   */
  get sublayers(): Collection<SubtypeSublayer>;
  set sublayers(value: ReadonlyArrayOrCollection<SubtypeSublayerProperties>);
  /** The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. */
  get type(): "subtype-group";
  /**
   * Adds an attachment to a feature. This operation is available only if the layer's
   * [capabilities.data.supportsAttachment](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities) is set to `true`.
   *
   * @param feature - Feature to which the attachment is to be added.
   * @param attachment - HTML form that contains a file upload field pointing to the file to be added as an attachment.
   * @returns When resolved, a [FeatureEditResult](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult)
   * object is returned. FeatureEditResult indicates whether or not the edit was successful. If successful, the `objectId` of the result is the Id of
   * the new attachment. If unsuccessful, it also includes an error `name` and error `message`.
   * @see [capabilities.data.supportsAttachment](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities)
   * @example
   * view.when(function () {
   *   view.on("click", function (event) {
   *
   *     view.hitTest(event).then(function (response) {
   *       const feature = response.results[0].graphic;
   *
   *       // The form is defined as below in the html.
   *       // For enterprise services:
   *       // 1. File input name must be "attachment"
   *       // <form id="attachmentForm">
   *       //   Select a file: <input type="file" name="attachment">
   *       // </form>
   *       const attachmentForm = document.getElementById("attachmentForm");
   *       const formData = new FormData(attachmentForm);
   *
   *       // For enterprise services - add input with name:f and value:json
   *       formData.append("f","json");
   *       const form = new FormData();
   *       form.set("attachment", file);
   *       form.append("f","json")
   *       let form = document.getElementById("myForm");
   *
   *       // Add an attachment to the clicked feature.
   *       // The attachment is taken from the form.
   *       layer.addAttachment(feature, form).then(function (result) {
   *         console.log("attachment added: ", result);
   *       })
   *       .catch(function (err) {
   *         console.log("attachment adding failed: ", err);
   *       });
   *     });
   *   });
   * });
   */
  addAttachment(feature: Graphic, attachment: HTMLFormElement | FormData): Promise<FeatureEditResult>;
  /**
   * Applies edits to features in a layer. New features can be created and existing features can be updated or deleted. Feature geometries and/or attributes may be modified.
   * Only applicable to layers in a [feature service](https://developers.arcgis.com/rest/services-reference/feature-service.htm)
   * and client-side features set through the FeatureLayer's [FeatureLayer.source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source) property. Attachments can also be added, updated or deleted.
   *
   * If client-side features are added, removed or updated at runtime using [applyEdits()](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#applyEdits) then use FeatureLayer's
   * [FeatureLayer.queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#queryFeatures) method to return updated features.
   *
   * > [!WARNING]
   * >
   * > **Notes**
   * >
   * > FeatureLayers are not optimized for high-frequency, dynamic data, or real-time streaming use cases. As a result, they may not perform efficiently with rapidly updating data streams.
   * > For real-time or dynamic data updates, use [StreamLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/StreamLayer/), which are designed for efficient handling of high-frequency streaming data and dynamic features.
   * >
   * > When calling the applyEdits method on a service that does not have [vertical coordinate system](https://pro.arcgis.com/en/pro-app/help/mapping/properties/vertical-coordinate-systems.htm) information,
   * > the z-values of the geometries in the `edits` object will automatically be converted to match the spatial reference of the layer.
   * > Example: The service has a horizontal spatial reference with `feet` units, and `applyEdits()` is called with z-values based on `meter` units,
   * > then the method will automatically convert the z values from `meter` to `feet` units.
   * >
   * > As of version 4.17, using applyEdits to add geometries with z-values to a FeatureLayer with `hasZ: false` no longer silently drops the z-value and now throws an error.
   *
   * @param edits - Object containing features and attachments to be added, updated or deleted.
   * @param options - Additional edit options to specify when editing features or attachments.
   * @returns When resolved, an [EditsResult](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#EditsResult)
   * object is returned.
   * @see [Sample - Edit features](https://developers.arcgis.com/javascript/latest/sample-code/editing-applyedits/)
   * @example
   * function addFeature(geometry) {
   *   const attributes = {};
   *   attributes["Description"] = "This is the description";
   *   attributes["Address"] = "380 New York St";
   *
   *   // Date.now() returns number of milliseconds elapsed
   *   // since 1 January 1970 00:00:00 UTC.
   *   attributes["Report_Date"] = Date.now();
   *
   *   const addFeature =  new Graphic({
   *     geometry: geometry,
   *     attributes: attributes
   *   });
   *
   *   const deleteFeatures = [
   *     { objectId: 467 },
   *     { objectId: 500 }
   *   ];
   *
   *   // or specify globalIds of features to be deleted
   *   // const deleteFeature = [
   *   //  { globalId: "18633204-1801-4d35-a73a-174563608ad9" }
   *   // ];
   *
   *   const promise = featureLayer.applyEdits({
   *     addFeatures: [addFeature],
   *     deleteFeatures: deleteFeatures
   *   });
   * }
   */
  applyEdits(edits: Edits, options?: EditOptions): Promise<EditsResult>;
  /**
   * Creates query parameter object that can be used to fetch features that
   * satisfy the layer's configurations such as [definitionExpression](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#definitionExpression),
   * [gdbVersion](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#gdbVersion), and [historicMoment](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#historicMoment).
   * It will return `Z` and `M` values based on the layer's [data capabilities](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities).
   * It sets the query parameter's [Query.outFields](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outFields) property to `["*"]`.
   * The results will include geometries of features and values for all
   * [available fields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLikeLayerView/#availableFields) for
   * [client-side queries](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLikeLayerView/#queryFeatures)
   * or all fields in the layer for [server side queries](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#queryFeatures).
   *
   * @returns The query object representing the layer's definition expression
   * and other configurations.
   * @see [Sample - Query features from a SubtypeGroupLayer](https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-query/)
   * @example
   * // this snippet shows the query parameter object that is returned
   * // from SubtypeGroupLayer.createQuery().
   * const queryParams = new Query();
   * const dataCapabilities = layer.get<DataCapabilities>("capabilities.data");
   *
   * queryParams.gdbVersion = layer.gdbVersion;
   * queryParams.historicMoment = layer.historicMoment;
   * queryParams.returnGeometry = true;
   *
   * if (dataCapabilities) {
   *   if (dataCapabilities.supportsZ && layer.returnZ != null) {
   *     queryParams.returnZ = layer.returnZ;
   *   }
   *
   *   if (dataCapabilities.supportsM && layer.returnM != null) {
   *     queryParams.returnM = layer.returnM;
   *   }
   * }
   *
   * queryParams.outFields = ["*"];
   * queryParams.where = layer.definitionExpression || "1=1";
   * queryParams.multipatchOption = layer.geometryType === "multipatch" ? "xyFootprint" : null;
   * @example
   * // Get a query object for the layer's current configuration
   * // queryParams.outFields will be set to ["*"] to get values
   * // for all available fields.
   * const queryParams = layer.createQuery();
   * // set a geometry for filtering features by a region of interest
   * queryParams.geometry = extentForRegionOfInterest;
   * // Add to the layer's current definitionExpression
   * queryParams.where = queryParams.where + " AND TYPE = 'Extreme'";
   *
   * // query the layer with the modified params object
   * layer.queryFeatures(queryParams).then(function(results){
   *   // prints the array of result graphics to the console
   *   console.log(results.features);
   * });
   */
  createQuery(): Query;
  /**
   * Deletes attachments from a feature. This operation is available only if the layer's
   * [capabilities.data.supportsAttachment](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities) is set to `true`.
   *
   * @param feature - Feature containing attachments to be deleted.
   * @param attachmentIds - Ids of the attachments to be deleted.
   * @returns When resolved, an array of [FeatureEditResults](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult)
   * is returned.  FeatureEditResult indicates whether or not the edit was successful. If successful, the `objectId` of the result is the Id of
   * the new attachment. If unsuccessful, it also includes an error `name` and error `message`.
   * @see [capabilities.data.supportsAttachment](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities)
   */
  deleteAttachments(feature: Graphic, attachmentIds: number[]): Promise<FeatureEditResult[]>;
  /**
   * Returns the sublayer to which the given feature belongs.
   *
   * @param feature - The feature whose sublayer will be returned.
   * @returns The sublayer from the `SubtypeGroupLayer` to which the feature belongs to.
   * @since 4.27
   */
  findSublayerForFeature(feature: Graphic): SubtypeSublayer | null | undefined;
  /**
   * Returns the sublayer with the [SubtypeSublayer.subtypeCode](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/#subtypeCode) that matches the number passed as an argument.
   *
   * @param subtypeCode - The subtype coded value.
   * @returns The sublayer from the `SubtypeGroupLayer` to which the feature belongs to.
   * @since 4.27
   * @example
   * // Updates the renderer of a sublayer after first finding
   * // the sublayer from the subtypeCode.
   * const subtypeCode = 5;
   * const subtypeSublayer = subtypeGroupLayer.findSublayerForSubtypeCode(subtypeCode);
   *
   * subtypeSublayer.renderer = new SimpleMarkerSymbol({
   *   color: "#ffffff",
   *   size: 12,
   *   outline: {
   *     color: "#000000",
   *     width: 1
   *   }
   * });
   */
  findSublayerForSubtypeCode(subtypeCode: number): SubtypeSublayer | null | undefined;
  /**
   * Loads all of the sublayers. See [loaded](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#loaded) or [loadStatus](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#loadStatus)
   * properties to check the status.
   *
   * @returns Resolves when all the sublayers have been [loaded](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#loaded).
   *   Rejects if one or more of the sublayers failed to load.
   * @see [load()](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#load)
   * @example
   * // Load all resources but ignore if one or more of them failed to load
   * subtypeGroupLayer.loadAll()
   *   .catch(function(error) {
   *     // Ignore any failed sublayers
   *   })
   *   .then(function() {
   *     console.log("All loaded");
   *   });
   */
  loadAll(): Promise<this>;
  /**
   * Query information about attachments associated with features. It will return an error if the layer's
   * [capabilities.data.supportsAttachment](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities) property is `false`.
   * Attachments for multiple features can be queried if the layer's [capabilities.operations.supportsQueryAttachments](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities)
   * is `true`.
   *
   * > [!WARNING]
   * >
   * > **Known Limitations**
   * >
   * > When the layer's[capabilities.operations.supportsQueryAttachments](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities) property is
   * > `false`, [AttachmentQuery.objectIds](https://developers.arcgis.com/javascript/latest/references/core/rest/support/AttachmentQuery/#objectIds) property only accepts a single
   * > `objectId`.
   *
   * @param attachmentQuery - Specifies the attachment parameters for query.
   * @param options - An object with the following properties.
   * @returns When resolved, returns an object containing
   * [AttachmentInfos](https://developers.arcgis.com/javascript/latest/references/core/rest/query/support/AttachmentInfo/) grouped by the source
   * feature objectIds.
   * @see [capabilities.data.supportsAttachment](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities)
   * @see [capabilities.operations.supportsQueryAttachments](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities)
   * @example
   * layer.when(function () {
   *   // queryObjectIds for all features within the layer
   *   layer.queryObjectIds().then(function (objectIds) {
   *     // Define parameters for querying attachments,
   *     // query features where objectIds are less than 735,
   *     // and only query jpeg attachments for these features.
   *     let attachmentQuery = {
   *       objectIds: objectIds,
   *       definitionExpression: "OBJECTID < 735",
   *       attachmentTypes: ["image/jpeg"]
   *     };
   *
   *     // Only pass in one objectId for attachmentQuery.objectIds
   *     // if the layer's capabilities.operations.supportsQueryAttachments is false
   *     layer.queryAttachments(attachmentQuery).then(function (attachments) {
   *       // Print out all returned attachment infos to the console.
   *       attachmentQuery.objectIds.forEach(function (objectId) {
   *         if (attachments[objectId]) {
   *           let attachment = attachments[objectId];
   *           console.group("attachment for", objectId);
   *           attachment.forEach(function (item) {
   *             console.log("attachment id", item.id);
   *             console.log("content type", item.contentType);
   *             console.log("name", item.name);
   *             console.log("size", item.size);
   *             console.log("url", item.url);
   *             console.groupEnd();
   *           });
   *         }
   *       });
   *     })
   *     .catch(function (error) {
   *       console.log("attachment query error", error);
   *     })
   *   });
   * });
   */
  queryAttachments(attachmentQuery: AttachmentQueryProperties, options?: RequestOptions): Promise<Record<string, AttachmentInfo[]>>;
  /**
   * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the feature service and
   * returns the [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) of features that satisfy the query. If no
   * parameters are specified, then the extent and count of all features
   * satisfying the layer's configuration/filters are returned. This is valid only for
   * [hosted feature services](https://doc.arcgis.com/en/arcgis-online/share-maps/hosted-web-layers.htm)
   * on [arcgis.com](https://arcgis.com) and for ArcGIS Server 10.3.1 and later.
   *
   * > [!WARNING]
   * >
   * > To query for the extent of features/graphics available to or visible in the
   * > [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/) on the client rather than making a server-side query, you must
   * > use the
   * > [SubtypeGroupLayerView#queryExtent](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLikeLayerView/#queryExtent)
   * > method.
   *
   * @param query - Specifies the attributes and spatial
   * filter of the query. If no parameters are specified, then the extent and count of all features
   * satisfying the layer's configuration/filters are returned.
   * @param options - An object with the following properties.
   * @returns When resolved, returns the extent and count of the features
   * that satisfy the input query. See the object specification table below for details.
   * Property | Type | Description
   * ---------|------|-------------
   * count | Number | The number of features that satisfy the input query.
   * extent | [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) \| null | The extent of the features that satisfy the query.
   * @example
   * // Queries for the extent of all features matching the layer's configurations
   * // e.g. definitionExpression
   * layer.queryExtent().then(function(results){
   *   // go to the extent of the results satisfying the query
   *   view.goTo(results.extent);
   * });
   * @example
   * const layer = new SubtypeGroupLayer({
   *   url: fsUrl  // points to a Feature Service layer url
   * });
   *
   * const query = new Query();
   * query.where = "region = 'Southern California'";
   *
   * layer.queryExtent(query).then(function(results){
   *   view.goTo(results.extent);  // go to the extent of the results satisfying the query
   * });
   */
  queryExtent(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise<{
      count: number;
      extent: Extent | null;
  }>;
  /**
   * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the feature service and
   * returns the number of features that satisfy the query. If no parameters are specified,
   * the total number of features satisfying the layer's configuration/filters is returned.
   *
   * > [!WARNING]
   * >
   * > To query for the count of features/graphics available to or visible in the
   * > [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/) on the client rather than making a server-side query, you must
   * > use the
   * > [SubtypeGroupLayerView#queryFeatureCount](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLikeLayerView/#queryFeatureCount)
   * > method.
   *
   * @param query - Specifies the attributes and
   * spatial filter of the query. If no parameters are specified, the total number of features
   * satisfying the layer's configuration/filters is returned.
   * @param options - An object with the following properties.
   * @returns When resolved, returns the number of features that satisfy the query.
   * @example
   * // Queries for the count of all features matching the layer's configurations
   * // e.g. definitionExpression
   * layer.queryFeatureCount().then(function(numFeatures){
   *   // prints the total count to the console
   *   console.log(numFeatures);
   * });
   * @example
   * const layer = new SubtypeGroupLayer({
   *   url: fsUrl  // points to a Feature Service layer url
   * });
   *
   * const query = new Query();
   * query.where = "region = 'Southern California'";
   *
   * layer.queryFeatureCount(query).then(function(numResults){
   *   console.log(numResults);  // prints the number of results satisfying the query
   * });
   */
  queryFeatureCount(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise<number>;
  /**
   * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the feature service and returns a
   * [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) once the promise resolves.
   * A [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) contains an array of [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/)
   * features.
   *
   * > [!WARNING]
   * >
   * > To query features/graphics available to or visible in the
   * > [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/) on the client rather than making a server-side query, you must
   * > use the
   * > [SubtypeGroupLayerView#queryFeatures](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLikeLayerView/#queryFeatures)
   * > method.
   * >
   * > When querying a service with z-values and no [vertical coordinate system](https://pro.arcgis.com/en/pro-app/help/mapping/properties/vertical-coordinate-systems.htm) information,
   * > the z-values will automatically be converted to match the [Query.outSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outSpatialReference) units.
   * > Example: The service has a horizontal spatial reference using `feet` units and the query is made with `outSpatialReference`
   * > based on `meter` units, then [queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#queryFeatures) automatically converts the values from `feet` to `meter` units.
   *
   * @param query - Specifies the attributes and spatial
   * filter of the query. If no parameters are specified, then all features satisfying the layer's
   * configuration/filters are returned.
   * @param options - An object with the following properties.
   * @returns When resolved, a [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) containing
   * an array of graphic features is returned.
   * @see [Sample - Query features from a SubtypeGroupLayer](https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-query/)
   * @see [Query and filter guide](https://developers.arcgis.com/javascript/latest/query-filter/)
   * @example
   * // Queries for all the features matching the layer's configurations
   * // e.g. definitionExpression
   * layer.queryFeatures().then(function(results){
   *   // prints the array of result graphics to the console
   *   console.log(results.features);
   * });
   * @example
   * const layer = new SubtypeGroupLayer({
   *   url: fsUrl  // points to a Feature Service layer url
   * });
   *
   * const query = new Query();
   * query.where = "STATE_NAME = 'Washington'";
   * query.outSpatialReference = { wkid: 102100 };
   * query.returnGeometry = true;
   * query.outFields = [ "CITY_NAME" ];
   *
   * layer.queryFeatures(query).then(function(results){
   *   console.log(results.features);  // prints the array of features to the console
   * });
   * @example
   * // Get a query object for the layer's current configuration
   * const queryParams = layer.createQuery();
   * // set a geometry for filtering features by a region of interest
   * queryParams.geometry = extentForRegionOfInterest;
   * // Add to the layer's current definitionExpression
   * queryParams.where = queryParams.where + " AND TYPE = 'Extreme'";
   *
   * // query the layer with the modified params object
   * layer.queryFeatures(queryParams).then(function(results){
   *   // prints the array of result graphics to the console
   *   console.log(results.features);
   * });
   * @example
   * const layer = new SubtypeGroupLayer({
   *   url: fsUrl  // points to a Feature Service layer url
   * });
   *
   * // query all features from the layer and only return
   * // attributes specified in outFields.
   * const query = { // autocasts as Query
   *   where: "1=1", // select all features
   *   returnGeometry: false,
   *   outFields: ["State_Name", "City_Name", "pop2010"]
   * };
   *
   * layer.queryFeatures(query).then(function(results){
   *   console.log(results.features);  // prints the array of features to the console
   * });
   */
  queryFeatures(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise<FeatureSet>;
  /**
   * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the feature service and returns an
   * array of Object IDs for features that satisfy the input query. If no parameters are specified,
   * then the Object IDs of all features satisfying the layer's configuration/filters are returned.
   *
   * > [!WARNING]
   * >
   * > To query for ObjectIDs of features/graphics available to or visible in the
   * > [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/) on the client rather than making a server-side query, you must
   * > use the
   * > [SubtypeGroupLayerView#queryObjectIds](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLikeLayerView/#queryObjectIds)
   * > method.
   *
   * @param query - Specifies the attributes and spatial
   * filter of the query. If no parameters are specified, then the Object IDs of all features
   * satisfying the layer's configuration/filters are returned.
   * @param options - An object with the following properties.
   * @returns When resolved, returns an array of numbers representing the object IDs of the features
   *                   satisfying the query.
   * @example
   * // Queries for all the Object IDs of features matching the layer's configurations
   * // e.g. definitionExpression
   * layer.queryObjectIds().then(function(results){
   *   // prints the array of Object IDs to the console
   *   console.log(results);
   * });
   * @example
   * const layer = new SubtypeGroupLayer({
   *   url: fsUrl  // points to a Feature Service layer url
   * });
   *
   * const query = new Query();
   * query.where = "region = 'Southern California'";
   *
   * layer.queryObjectIds(query).then(function(ids){
   *   console.log(ids);  // an array of object IDs
   * });
   */
  queryObjectIds(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise<number[]>;
  /**
   * Executes a [RelationshipQuery](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RelationshipQuery/) against the feature service and
   * returns [FeatureSets](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) grouped by source layer or table objectIds.
   *
   * @param relationshipQuery - Specifies relationship parameters
   * for querying related features or records from a layer or a table.
   * @param options - An object with the following properties.
   * @returns When resolved, returns [FeatureSets](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) grouped
   * by source layer/table objectIds. Each [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) contains an array of [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/)
   * features including the values of the fields requested by the user.
   * @see [relationships property](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#relationships)
   * @see [Sample - Query Related Features](https://developers.arcgis.com/javascript/latest/sample-code/query-related-features/)
   * @example
   * const objectIds = [385, 416];
   *
   * // relationship query parameter
   * const query = {
   *   outFields: ["*"],
   *   relationshipId: relationshipId,
   *   objectIds: objectIds
   * }
   *
   * // query related features for given objectIds
   * layer.queryRelatedFeatures(query).then(function (result) {
   *   objectIds.forEach(function (objectId) {
   *     // print out the attributes of related features if the result
   *     // is returned for the specified objectId
   *     if (result[objectId]) {
   *       console.group("relationship for feature:", objectId)
   *       result[objectId].features.forEach(function (feature) {
   *         console.log("attributes", JSON.stringify(feature.attributes));
   *       });
   *       console.groupEnd();
   *     }
   *   });
   * }).catch(function (error) {
   *   console.log("error from queryRelatedFeatures", error);
   * });
   */
  queryRelatedFeatures(relationshipQuery: RelationshipQueryProperties, options?: RequestOptions): Promise<Record<string, FeatureSet>>;
  /**
   * Executes a [RelationshipQuery](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RelationshipQuery/) against the feature service and
   * when resolved, it returns an `object` containing key value pairs. Key in this case is the `objectId`
   * of the feature and value is the number of related features associated with the feature.
   *
   * @param relationshipQuery - Specifies relationship parameters
   * for querying related features or records from a layer or a table.
   * @param options - An object with the following properties.
   * @returns When resolved, returns a hashmap containing key value pairs. Key in this case is the `objectId`
   * of the feature and value is the number of related features.
   * @see [relationships property](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#relationships)
   * @see [Sample - Query Related Features](https://developers.arcgis.com/javascript/latest/sample-code/query-related-features/)
   * @example
   * const objectIds = [385, 416];
   *
   * // relationship query parameter
   * const query = {
   *   outFields: ["*"],
   *   relationshipId: relationshipId,
   *   objectIds: objectIds
   * }
   *
   * // query related features for given objectIds
   * layer.queryRelatedFeaturesCount(query).then(function (count) {
   *   console.log("queryRelatedFeaturesCount", count);
   *   // this will print out
   *   // {385: 91, 416: 23}
   * }).catch(function (error) {
   *   console.log("error from queryRelatedFeatures", error);
   * });
   */
  queryRelatedFeaturesCount(relationshipQuery: RelationshipQueryProperties, options?: RequestOptions): Promise<Record<string, number>>;
  /**
   * Saves the layer to its existing portal item in the [Portal](https://developers.arcgis.com/javascript/latest/references/core/portal/Portal/)
   * authenticated within the user's current session. If the layer is not saved to a
   * [PortalItem](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/), then you should use [saveAs()](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#saveAs).
   *
   * > [!WARNING]
   * >
   * > **Known Limitations**
   * >
   * > You can only save service-backed FeatureLayers. Client-side layers cannot 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.24
   * @example const portalItem = await layer.save();
   */
  save(options?: LayerSaveOptions): Promise<PortalItem>;
  /**
   * Saves the layer to a new portal item in the [Portal](https://developers.arcgis.com/javascript/latest/references/core/portal/Portal/)
   * authenticated within the user's current session.
   *
   * > [!WARNING]
   * >
   * > **Known Limitations**
   * >
   * > You can only save service-backed FeatureLayers. Client-side layers cannot be saved.
   *
   * @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.24
   * @example
   * const portalItem = new PortalItem();
   * await layer.saveAs(portalItem);
   */
  saveAs(portalItem: PortalItemProperties, options?: LayerSaveAsOptions): Promise<PortalItem>;
  /**
   * Updates an existing attachment for a feature. This operation is available only if the layer's
   * [capabilities.data.supportsAttachment](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities) is set to `true`.
   *
   * @param feature - The feature containing the attachment to be updated.
   * @param attachmentId - Id of the attachment to be updated.
   * @param attachment - HTML form that contains a file upload field pointing to the file to be added as an attachment.
   * @returns When resolved, a [FeatureEditResult](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult)
   * object is returned. FeatureEditResult indicates whether or not the edit was successful. If successful, the `objectId` of the result is the Id of
   * the new attachment. If unsuccessful, it also includes an error `name` and error `message`.
   * @see [capabilities.data.supportsAttachment](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities)
   */
  updateAttachment(feature: Graphic, attachmentId: number, attachment: HTMLFormElement | FormData): Promise<FeatureEditResult>;
}
declare const SubtypeGroupLayerSuperclass: typeof Layer & typeof ClonableMixin & typeof APIKeyMixin & typeof CustomParametersMixin & typeof MultiOriginJSONSupportMixin & typeof PortalLayer & typeof OperationalLayer & typeof RefreshableLayer & typeof ScaleRangeLayer & typeof TemporalLayer & typeof BlendLayer & typeof EditBusLayer & typeof DisplayFilteredLayer & typeof FeatureLayerBase