/** @packageDocumentation
 * @module IModelConnection
 */
import { BeEvent, GuidString, Id64Set, Id64String, OpenMode } from "@itwin/core-bentley";
import { BriefcaseConnectionProps, ChangesetIndex, ChangesetIndexAndId, LockState, OpenBriefcaseProps, StandaloneOpenOptions } from "@itwin/core-common";
import { BriefcaseTxns } from "./BriefcaseTxns";
import { GraphicalEditingScope } from "./GraphicalEditingScope";
import { IModelConnection } from "./IModelConnection";
/**
 * Download progress information.
 * @public
 */
export interface DownloadProgressInfo {
    /** Bytes downloaded. */
    loaded: number;
    /** Total size of the download in bytes. */
    total: number;
}
/**
 * Called to show progress during a download.
 * @public
 */
export type OnDownloadProgress = (progress: DownloadProgressInfo) => void;
/**
 * Partial interface of AbortSignal.
 * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
 * @beta
 */
export interface GenericAbortSignal {
    /** Add Listener for abort signal. */
    addEventListener: (type: "abort", listener: (this: GenericAbortSignal, ev: any) => any) => void;
    /** Remove Listener for abort signal. */
    removeEventListener: (type: "abort", listener: (this: GenericAbortSignal, ev: any) => any) => void;
}
/**
 * Options for pulling iModel changes.
 * @public
 */
export interface PullChangesOptions {
    /** Function called regularly to report progress of changes download. */
    downloadProgressCallback?: OnDownloadProgress;
    /** Interval for calling progress callback (in milliseconds). */
    progressInterval?: number;
    /** Signal for cancelling the download.
     * @beta
     */
    abortSignal?: GenericAbortSignal;
}
/**
 * Provides access to lock information in the iModel.
 * @see [[BriefcaseConnection.locks]]
 * @alpha
 */
export interface LockService {
    /** Get all elements with exclusive locks owned by other briefcases. */
    getExclusiveForeignLocks(): Promise<Id64Set>;
    /** Get all elements with shared locks owned by other briefcases. */
    getSharedForeignLocks(): Promise<Id64Set>;
    /** Check whether it's possible to acquire a lock for the element. */
    checkElementLockAvailability(elementId: Id64String, lock: LockState): Promise<boolean>;
}
/** Function for creating a [[LockService]] for a [[BriefcaseConnection]].
 * @alpha
 */
export type LockServiceFactory = (iModel: BriefcaseConnection) => Promise<LockService>;
/** Settings that can be used to control the behavior of [[Tool]]s that modify a [[BriefcaseConnection]].
 * For example, tools that want to create new elements can consult the briefcase's editor tool settings to
 * determine into which model and category to insert the elements.
 * Specialized tools are free to ignore these settings.
 * @see [[BriefcaseConnection.editorToolSettings]] to query or modify the current settings for a briefcase.
 * @see [CreateElementTool]($editor-frontend) for an example of a tool that uses these settings.
 * @beta
 */
export declare class BriefcaseEditorToolSettings {
    private _category?;
    private _model?;
    /** An event raised just after the default [[category]] is changed. */
    readonly onCategoryChanged: BeEvent<(previousCategory: Id64String | undefined) => void>;
    /** An event raised just after the default [[model]] is changed. */
    readonly onModelChanged: BeEvent<(previousModel: Id64String | undefined) => void>;
    /** The [Category]($backend) into which new elements should be inserted by default.
     * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate category.
     * @see [[onCategoryChanged]] to be notified when this property is modified.
     * @see [CreateElementTool.targetCategory]($editor-frontend) for an example of a tool that uses this setting.
     */
    get category(): Id64String | undefined;
    set category(category: Id64String | undefined);
    /** The [Model]($backend) into which new elements should be inserted by default.
     * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate model.
     * @see [[onModelChanged]] to be notified when this property is modified.
     * @see [CreateElementTool.targetModelId]($editor-frontend) for an example of a tool that uses this setting.
     */
    get model(): Id64String | undefined;
    set model(model: Id64String | undefined);
}
/** A connection to an editable briefcase on the backend. This class uses [Ipc]($docs/learning/IpcInterface.md) to communicate
 * to the backend and may only be used by [[IpcApp]]s.
 * @public
 */
export declare class BriefcaseConnection extends IModelConnection {
    protected _isClosed?: boolean;
    private readonly _modelsMonitor;
    private _locks?;
    /** The ID of the briefcase.
     * @beta
     */
    readonly briefcaseId?: number;
    /** Default settings that can be used to control the behavior of [[Tool]]s that modify this briefcase.
     * @beta
     */
    readonly editorToolSettings: BriefcaseEditorToolSettings;
    /** Manages local changes to the briefcase via [Txns]($docs/learning/InteractiveEditing.md). */
    readonly txns: BriefcaseTxns;
    /** Information about locks held on this iModel.
     * @note This is intended to be used by tools and other UI elements, to provide information about the current lock state. Implementations are expected to cache lock information and so may not reflect changes to locks immediately.
     * @alpha
     */
    get locks(): LockService | undefined;
    isBriefcaseConnection(): this is BriefcaseConnection;
    /** The Guid that identifies the iTwin that owns this iModel. */
    get iTwinId(): GuidString;
    /** The Guid that identifies this iModel. */
    get iModelId(): GuidString;
    protected constructor(props: BriefcaseConnectionProps, openMode: OpenMode);
    /** Open a BriefcaseConnection to a [BriefcaseDb]($backend). */
    static openFile(briefcaseProps: OpenBriefcaseProps): Promise<BriefcaseConnection>;
    /** Open a BriefcaseConnection to a [BriefcaseDb]($backend).
     * @alpha
     */
    static openFile(briefcaseProps: OpenBriefcaseProps, lockServiceFactory?: LockServiceFactory): Promise<BriefcaseConnection>;
    /** Open a BriefcaseConnection to a [StandaloneDb]($backend)
     * @note StandaloneDbs, by definition, may not push or pull changes. Attempting to do so will throw exceptions.
     */
    static openStandalone(filePath: string, openMode?: OpenMode, opts?: StandaloneOpenOptions): Promise<BriefcaseConnection>;
    /** Returns `true` if [[close]] has already been called. */
    get isClosed(): boolean;
    /**
     * Close this BriefcaseConnection.
     * @note make sure to call [[saveChanges]] before calling this method. Unsaved local changes are abandoned.
     */
    close(): Promise<void>;
    protected requireTimeline(): void;
    /** Query if there are any pending Txns in this briefcase that are waiting to be pushed. */
    hasPendingTxns(): Promise<boolean>;
    /** Commit pending changes to this briefcase.
     * @param description Optional description of the changes.
     * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
     */
    saveChanges(description?: string): Promise<void>;
    /** Abandon pending changes to this briefcase.
     * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
     */
    abandonChanges(): Promise<void>;
    /** Pull (and potentially merge if there are local changes) up to a specified changeset from iModelHub into this briefcase
     * @param toIndex The changeset index to pull changes to. If `undefined`, pull all changes.
     * @param options Options for pulling changes.
     * @see [[BriefcaseTxns.onChangesPulled]] for the event dispatched after changes are pulled.
     */
    pullChanges(toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<void>;
    /** Create a changeset from local Txns and push to iModelHub. On success, clear Txn table.
     * @param description The description for the changeset
     * @returns the changesetId of the pushed changes
     * @see [[BriefcaseTxns.onChangesPushed]] for the event dispatched after changes are pushed.
     */
    pushChanges(description: string): Promise<ChangesetIndexAndId>;
    /** The current graphical editing scope, if one is in progress.
     * @see [[enterEditingScope]] to begin graphical editing.
     */
    get editingScope(): GraphicalEditingScope | undefined;
    /** Return whether graphical editing is supported for this briefcase. It is not supported if the briefcase is read-only, or the briefcase contains a version of
     * the BisCore ECSchema older than v0.1.11.
     * @see [[enterEditingScope]] to enable graphical editing.
     */
    supportsGraphicalEditing(): Promise<boolean>;
    /** Begin a new graphical editing scope.
     * @throws Error if an editing scope already exists or one could not be created.
     * @see [[GraphicalEditingScope.exit]] to exit the scope.
     * @see [[supportsGraphicalEditing]] to determine whether this method should be expected to succeed.
     * @see [[editingScope]] to obtain the current editing scope, if one is in progress.
     */
    enterEditingScope(): Promise<GraphicalEditingScope>;
    /** Strictly for tests - dispatched from ModelChangeMonitor.processBuffered.
     * @internal
     */
    readonly onBufferedModelChanges: BeEvent<(changedModelIds: Set<string>) => void>;
}
//# sourceMappingURL=BriefcaseConnection.d.ts.map