import Collection from "@arcgis/core/core/Collection";
import type { ResourceHandle } from "@arcgis/core/core/Handles.js";
import type Extent from "@arcgis/core/geometry/Extent";
import type SpatialReference from "@arcgis/core/geometry/SpatialReference";
import type Renderer from "@arcgis/core/renderers/Renderer";
import type { RendererUnion } from "@arcgis/core/renderers/types.js";
import type { Feature } from "../data/Feature.js";
import type { FeatureSet } from "../data/FeatureSet.js";
import type { FeatureReadOptions, FeatureWriteOptions } from "../data/FeatureSource.js";
import type { FeatureSourceBaseProperties } from "../data/FeatureSourceBase.js";
import { FeatureSourceBase } from "../data/FeatureSourceBase.js";
import type { QuerySourceCapabilities } from "../data/QuerySourceCapabilities.js";
import { Schema } from "../data/Schema.js";
import type { Relationship, RelationshipProperties } from "../data/_Relationship.js";
import type { SublayerJson } from "../json/SublayerJson.js";
import type { InitializableBase } from "../support/InitializableBase.js";
import type { PropertyDefs } from "../support/Serializable.js";
import type { SublayerLike, VisibilityMode } from "../support/esri.js";
import type { LayerExtension, LayerExtensionSchemaPropertyBinding } from "./_LayerExtension.js";
import type { LayerListSettingsProperties } from "./support/LayerListSettings.js";
import { LayerListSettings } from "./support/LayerListSettings.js";
import type { SublayerExtensionFactory } from "./support/SublayerExtensionFactory.js";
import type { SublayerExtensionCollection } from "./support/_SublayerExtensionCollection.js";
import { SublayerExtensionCollectionBase } from "./support/_SublayerExtensionCollection.js";
/**
 * Returns the sublayerType given an EsriSublayer.
 *
 * @param sublayer The sublayer for which to get the corresponding SublayerType.
 */
export declare function getSublayerType(sublayer: SublayerLike): SublayerType;
/**
 * Well-known sublayer types for use in sublayer JSON.
 */
export type SublayerType = 
/**
 * Sublayer for a MapImageLayer.
 */
"ArcGISMapServiceSublayer"
/**
 * Sublayer for a TileLayer.
 */
 | "ArcGISTiledSublayer"
/**
 * Sublayer for a KMLLayer.
 */
 | "KMLSublayer"
/**
 * Sublayer for a WMSLayer.
 */
 | "WMSSublayer"
/**
 * Sublayer for a WMTSLayer.
 */
 | "WMTSSublayer"
/**
 * BuildingComponent sublayer for a BuildingSceneLayer.
 */
 | "BuildingComponentSublayer"
/**
 * BuildingComponent sublayer for a BuildingSceneLayer.
 */
 | "BuildingGroupSublayer"
/**
 * SubtypeSublayer for a SubtypeGroupLayer.
 */
 | "SubtypeSublayer"
/**
 * MapNotesSublayer from MapNotesLayer.
 */
 | "MapNotesSublayer";
/**
 * Properties that can be specified for the
 * {@link mapping/_SublayerExtension!SublayerExtensionProperties.sublayer}
 * property.
 */
export interface SublayerProperties extends SublayerJson {
    /**
     * A reference to an existing sublayer, which is the ID or title of the
     * sublayer (or both). In this case, the sublayer extension will attempt to
     * find an existing sublayer instead of creating one.
     */
    $ref?: string | number | SublayerReference;
    /**
     * The type of sublayer. This property is required when calling
     * {@link mapping/_SublayerExtension!SublayerExtension.create}.
     */
    $sublayerType?: string;
}
/**
 * Matches an existing sublayer in a layer.
 */
export interface SublayerReference {
    /**
     * The sublayer's ID.
     */
    id?: number | string;
    /**
     * The sublayer's title.
     */
    title?: string;
}
/**
 * Properties that can be passed into the constructor for
 * {@link mapping/_SublayerExtension!SublayerExtension}.
 */
export interface SublayerExtensionProperties extends FeatureSourceBaseProperties {
    /**
     * See {@link mapping/_SublayerExtension!SublayerExtension.sublayer}.
     */
    sublayer?: SublayerLike | SublayerProperties;
    /**
     * See
     * {@link mapping/_SublayerExtension!SublayerExtension.sublayerExtensions}.
     */
    sublayerExtensions?: (SublayerExtension | SublayerExtensionProperties)[];
    /**
     * See
     * {@link mapping/_SublayerExtension!SublayerExtension.layerListSettings}.
     */
    layerListSettings?: LayerListSettingsProperties;
    /**
     * See {@link mapping/_SublayerExtension!SublayerExtension.relationships}.
     */
    relationships?: (Relationship | RelationshipProperties)[];
    /**
     * See {@link mapping/_SublayerExtension!SublayerExtension.iconUrl}.
     */
    iconUrl?: string;
    /**
     * See {@link mapping/_SublayerExtension!SublayerExtension.visibilityMode}.
     */
    visibilityMode?: VisibilityMode;
}
/**
 * Extends the capabilities of an Esri Sublayer object.
 */
export declare abstract class SublayerExtension<TProperties extends SublayerExtensionProperties = SublayerExtensionProperties> extends FeatureSourceBase<TProperties> {
    /**
     * The factory that will be used whenever a new sublayer extension needs to
     * be created. Applications can supply their own factory to customize
     * sublayer extension creation.
     */
    static factory: SublayerExtensionFactory;
    /**
     * The sublayer that is being extended.
     */
    get sublayer(): SublayerLike;
    /**
     * The layer extension that this sublayer extension belongs to.
     */
    get layerExtension(): LayerExtension;
    /**
     * The sublayer extension that this sublayer extension belongs to.
     */
    get parentSublayerExtension(): SublayerExtension;
    /**
     * Determines whether this type of layer is capable of producing features.
     */
    get hasFeatures(): boolean;
    /**
     * The sublayer extensions associated with each sublayer of this sublayer.
     */
    get sublayerExtensions(): SublayerExtensionCollection;
    /**
     * The renderer, if any, that the ESRI sublayer uses to display data on the
     * map.
     */
    get renderer(): RendererUnion;
    /**
     * Settings that affect the behavior and presentation of the sublayer in the
     * layer list.
     */
    readonly layerListSettings: LayerListSettings;
    /**
     * Indicates how to manage the visibility of the children layers.
     */
    get visibilityMode(): VisibilityMode;
    set visibilityMode(value: VisibilityMode);
    get capabilities(): QuerySourceCapabilities;
    /**
     * The effective min scale for this sublayer extension.
     */
    get effectiveMinScale(): number;
    /**
     * The effective max scale for this sublayer extension.
     */
    get effectiveMaxScale(): number;
    /**
     * The effective visibility for this sublayer extension.
     */
    get isEffectivelyVisible(): boolean;
    /**
     * See {@link data/FeatureSource!FeatureSource.title}.
     */
    get title(): string;
    /**
     * Determines whether this type of sublayer is capable of having sublayers.
     */
    get supportsSublayers(): boolean;
    /**
     * Determines whether the type of sublayer being extended supports toggling
     * visibility. Sublayers belonging to tiled layers cannot have their
     * visibilities toggled, for example. The default is true.
     */
    get canToggleVisibility(): boolean;
    /**
     * Determines whether the type of sublayer being extended supports changing
     * opacity. Sublayers belonging to tiled layers cannot have their opacity
     * changed, for example. The default is true.
     */
    get canChangeOpacity(): boolean;
    /**
     * Determines whether the type of sublayer being extended supports changing
     * Scale. Sublayers belonging to tiled layers cannot have their scale
     * changed, for example. The default is true.
     */
    get canChangeScale(): boolean;
    /**
     * Determines whether the type of sublayer being extended supports changing
     * its renderer.
     */
    get canChangeRenderer(): boolean;
    /**
     * Determines whether the type of sublayer being extended supports changing
     * labels. Default is false.
     */
    get canChangeLabels(): boolean;
    /**
     * Determines whether the type of sublayer being extended supports changing
     * its definition expression.
     */
    get canChangeDefinitionExpression(): boolean;
    /**
     * The sublayer's sublayers.
     */
    private get _sublayers();
    /**
     * The effective full extent of this sublayer extension.
     */
    get effectiveFullExtent(): Extent;
    /**
     * String value containing the initial definition expression configured on
     * the layer.
     */
    get initialDefinitionExpression(): string | undefined;
    /**
     * A clone of the initial renderer, if any, that the ESRI layer uses to
     * display data on the map.
     */
    get initialRenderer(): Renderer | undefined;
    /**
     * Indicates the initial layer visibility.
     */
    get initialVisibility(): boolean;
    /**
     * See
     * {@link mapping/_SublayerExtension!SublayerExtension.effectiveFullExtent}.
     */
    protected _effectiveFullExtent: Extent;
    /**
     * @inheritDoc
     */
    protected readonly _itemType: string;
    /**
     * A set of watch handles that get cleaned up when the class instance is
     * destroyed.
     */
    protected readonly _watchHandles: ResourceHandle[];
    private readonly _sublayerExtensions;
    private _layerExtension;
    private _parentSublayerExtension;
    private _initialDefinitionExpression;
    private _initialRenderer;
    private _initialVisibility;
    private _sublayer;
    private _visibilityMode;
    private _deferredSublayerProperties;
    private _originalRef;
    /**
     * Creates a new instance of
     * {@link mapping/_SublayerExtension!SublayerExtension}.
     *
     * @param properties An object containing initial property values to set.
     */
    constructor(properties?: TProperties);
    /**
     * Creates the appropriate subclass of
     * {@link mapping/_SublayerExtension!SublayerExtension} based on the supplied
     * properties. Applications can customize the default creation behavior by
     * supplying a custom factory object (see
     * {@link mapping/_SublayerExtension!SublayerExtension.factory}).
     *
     * @param properties The sublayer extension properties.
     */
    static create(properties: SublayerExtensionProperties): SublayerExtension;
    getFeatures(ids: string[], options?: FeatureReadOptions): AsyncIterable<Feature>;
    getFullExtent(): Extent | undefined;
    addFeatures(features: FeatureSet, options?: FeatureWriteOptions): Promise<void>;
    updateFeatures(features: FeatureSet, options?: FeatureWriteOptions): Promise<void>;
    deleteFeatures(ids: Iterable<string>, options?: FeatureWriteOptions): Promise<void>;
    deleteFeatures(features: Iterable<Feature>, options?: FeatureWriteOptions): Promise<void>;
    protected _postInitialize(): Promise<void>;
    /**
     * A callback executed when a sublayer is added as a child of the
     * LayerExtension, after the LayerExtension has been initialized.
     *
     * @param sublayerX The sublayer that was added.
     */
    protected readonly _onSublayerAddedPostInitialize: (sublayerX: SublayerExtension) => Promise<void>;
    protected _onDestroy(): Promise<void>;
    protected _getSerializableProperties(): PropertyDefs<TProperties>;
    /**
     * Determines whether the sublayer is of the right type for the type of
     * sublayer extension.
     *
     * @param sublayer The sublayer to validate.
     */
    protected abstract _isSupportedSublayer(sublayer: SublayerLike): boolean;
    /**
     * Called to create a child sublayer extension.
     *
     * @param properties Properties used to initialize the sublayer extension.
     */
    protected _createSublayerExtension(properties?: TProperties): SublayerExtension;
    protected _createSchema(): Schema;
    /**
     * Called to create the
     * {@link mapping/support/LayerListSettings!LayerListSettings} for this
     * sublayer extension.
     *
     * @param properties Properties used to initialize the layer list settings.
     */
    protected _createLayerListSettings(properties?: LayerListSettingsProperties): LayerListSettings;
    /**
     * Called to create the sublayer for this sublayer extension.
     */
    protected abstract _createSublayer(properties: SublayerProperties): SublayerLike | Promise<SublayerLike>;
    /**
     * Called to apply properties to the sublayer for this sublayer extension.
     */
    protected abstract _applySublayerProperties(properties: SublayerProperties, sublayer: SublayerLike): void | Promise<void>;
    protected _capabilities(): QuerySourceCapabilities;
    protected _onInitialize(): Promise<void>;
    protected _initializableChildCollections(): IterableIterator<Collection<InitializableBase>>;
    /**
     * Serializes a sublayer.
     *
     * @param sublayer The sublayer to serialize.
     */
    protected abstract _serializeSublayer(sublayer: SublayerLike): SublayerProperties;
    /**
     * Creates a $ref for the this sublayer extension's sublayer.
     */
    protected _createSublayerRef(): SublayerProperties;
    /**
     * Called to create the
     * {@link mapping/support/_SublayerExtensionCollection!SublayerExtensionCollection}
     * for this sublayer extension.
     */
    protected _createSublayerExtensionCollection(): SubSublayerExtensionCollection;
    /**
     * Watches for changes on sublayer properties.
     */
    protected _watchSublayerProperties(): void;
    private _setSublayer;
    private readonly _onSetSublayerVisible;
    private readonly _onSetSublayersSublayerVisible;
    private readonly _onSublayersAfterAdd;
    private readonly _onSublayersAfterRemove;
    private _ensureAChildSublayerVisible;
    private _ensureAtMostOneChildSublayerVisible;
}
/**
 * An implementation of Schema that return the spatial reference of the parent
 * layer extension.
 */
export declare class SublayerSchema extends Schema {
    /**
     * The sublayer that the Schema represents.
     */
    protected readonly _sublayerExtension: SublayerExtension;
    /**
     * Maps schema properties to properties on Layer.
     */
    protected readonly _sublayerBindings: Map<string, LayerExtensionSchemaPropertyBinding>;
    constructor(sublayerExtension: SublayerExtension);
    get spatialReference(): SpatialReference;
    set spatialReference(value: SpatialReference);
    /**
     * Returns the property bindings.
     */
    protected _getPropertyBindings(): Partial<Record<keyof this, LayerExtensionSchemaPropertyBinding>>;
    /**
     * Binds the settings to the equivalent properties on the layer.
     */
    private _bindSettingsToSublayerProperties;
}
/**
 * A collection of sublayer extensions belonging to a SublayerExtension.
 */
export declare class SubSublayerExtensionCollection extends SublayerExtensionCollectionBase {
    /**
     * The SublayerExtension that owns this collection.
     */
    protected readonly _parent: SublayerExtension;
    /**
     * @inheritDoc
     */
    protected get _layerExtension(): LayerExtension;
    constructor(parent: SublayerExtension, sublayersProperty?: string);
    add(sublayerX: SublayerExtension, index?: number): this;
    protected _onAdded(sublayerExtension: SublayerExtension): void;
    protected _onRemoved(sublayerExtension: SublayerExtension): void;
}
