import type Collection from "@arcgis/core/core/Collection";
import type { FailureMode } from "../FailureMode.js";
import type { EventCallback } from "../support/esri.js";
import { InitializeError } from "./InitializeError.js";
import type { PropertyDefs, SerializeMode } from "./Serializable.js";
import { SerializableBase } from "./Serializable.js";
import type { ObservableMixin } from "./observableUtils.js";
/**
 * Represents an item that can be initialized.
 */
export interface Initializable extends ObservableMixin {
    /**
     * Indicates if the item has been initialized.
     */
    readonly isInitialized: boolean;
    /**
     * Indicates if the item has been destroyed. Once destroyed, it is not safe
     * to invoke any other methods on the object.
     */
    readonly isDestroyed: boolean;
    /**
     * Initializes the item.
     */
    initialize(): Promise<void>;
    /**
     * A clean-up function that should get called whenever the item is disposed
     * of.
     */
    destroy(): Promise<void>;
}
/**
 * Raised when there is an error initializing an
 * {@link support/InitializableBase!InitializableBase}.
 */
export interface InitializeWarningEvent {
    /**
     * Original error that occurred.
     */
    error: InitializeError;
    /**
     * The {@link support/InitializableBase!InitializableBase} that raised the
     * event.
     */
    target: InitializableBase;
}
/**
 * A callback that is invoked when
 * {@link support/InitializableBase!InitializeWarningEvent} is raised.
 */
export type InitializeWarningEventCallback = (event: InitializeWarningEvent) => void;
/**
 * Properties that can be passed into the constructor for
 * {@link support/InitializableBase!InitializableBase}.
 */
export interface InitializableBaseProperties {
    /**
     * See {@link support/InitializableBase!InitializableBase.failureMode}.
     */
    failureMode?: FailureMode;
}
/**
 * A type that maps event names to their corresponding event object types for an
 * instance of {@link InitializableBase}.
 */
export interface InitializableBaseEvents {
    /**
     * Fires when a setting is changed, either locally or by a parent settings
     * instance. The event object contains the name of the setting that
     * changed.
     */
    initializeWarning: InitializeWarningEvent;
}
declare const InitializableBase_base: (abstract new (_properties?: InitializableBaseProperties) => SerializableBase<InitializableBaseProperties>) & (abstract new (...args: any[]) => ObservableMixin);
/**
 * A base class that contains logic for initializing items.
 */
export declare abstract class InitializableBase<TProperties extends InitializableBaseProperties = InitializableBaseProperties> extends InitializableBase_base implements Initializable {
    /**
     * @deprecated Do not directly reference this property. Use EventNames and
     *   EventTypes helpers from @arcgis/core/Evented.
     */
    "@eventTypes": InitializableBaseEvents;
    /**
     * See {@link support/InitializableBase!Initializable.isInitialized}.
     */
    get isInitialized(): boolean;
    /**
     * See {@link support/InitializableBase!Initializable.isDestroyed}.
     */
    get isDestroyed(): boolean;
    /**
     * Determines how a parent object should handle initialization failure in
     * this object. The default is "warn".
     *
     * - `"error"`: {@link support/InitializeError!InitializeError} is thrown.
     * - `"warn"`: Message is logged and
     *   {@link support/InitializableBase!InitializeWarningEvent} is raised.
     * - `"ignore"`: {@link support/InitializableBase!InitializeWarningEvent} is
     *   raised.
     */
    get failureMode(): FailureMode;
    set failureMode(value: FailureMode);
    private _isInitialized;
    private _isDestroyed;
    private _initializePromise;
    private _destroyPromise;
    private _failureMode;
    /**
     * @inheritDoc
     */
    initialize(): Promise<void>;
    /**
     * @inheritDoc
     */
    destroy(): Promise<void>;
    toJSON(serializeMode?: SerializeMode): TProperties;
    assignProperties(properties: Partial<TProperties>): void;
    assignPropertiesAsync(properties: Partial<TProperties>): Promise<void>;
    getDefaults(): TProperties;
    getDefault<K extends keyof TProperties>(key: K): TProperties[K];
    getSerializableProperties(serializeMode?: SerializeMode): PropertyDefs<TProperties>;
    protected _getSerializableProperties(): PropertyDefs<TProperties>;
    /**
     * Called to perform initialization of the
     * {@link support/InitializableBase!InitializableBase}. Subclasses should
     * override this method rather than initialize() to perform custom
     * initialization.
     */
    protected _onInitialize(): Promise<void>;
    /**
     * Called after normal initialization. Note: Child items are initialized
     * before this is called.
     */
    protected _postInitialize(): Promise<void>;
    /**
     * Called to perform cleanup. Subclasses should override this method rather
     * than destroy() to perform custom cleanup.
     */
    protected _onDestroy(): Promise<void>;
    /**
     * Initializes child entities.
     */
    protected _initializeChildren(): Promise<void>;
    /**
     * Collections of child items to initialize. Items that fail to initialize
     * are removed from the collection.
     */
    protected _initializableChildCollections(): IterableIterator<Collection<InitializableBase>>;
}
/**
 * Options for the initializeCollection() function.
 */
export interface InitializeCollectionOptions {
    /**
     * An event callback for handling errors thrown by collection items with
     * failureMode "warn".
     */
    onInitializeWarning?: EventCallback<InitializeWarningEvent>;
    /**
     * The target to include in the {@link InitializeWarningEvent}.
     */
    target?: InitializableBase;
}
/**
 * Initializes a collection of {@link InitializableBase} items.
 *
 * @param collection The collection of items to initialize.
 * @param options Options including a callback and target for handling errors
 *   thrown by collection items with failureMode "warn".
 */
export declare function initializeCollection<T extends InitializableBase = InitializableBase>(collection: Collection<T>, options?: InitializeCollectionOptions): Promise<void>;
export {};
