/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import type { IIdCompressor } from "@fluidframework/id-compressor";
import { type DetachedFieldIndex, type IEditableForest, type IForestSubscription, type ReadOnlyDetachedFieldIndex, type TaggedChange, type TreeStoredSchemaRepository } from "../core/index.js";
import { disposeSymbol } from "../util/index.js";
import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
interface BorrowedState {
    readonly forest: IForestSubscription;
    readonly removedRoots: ReadOnlyDetachedFieldIndex;
}
interface OwnedState {
    readonly forest: IEditableForest;
    readonly removedRoots: DetachedFieldIndex;
}
export declare class SharedTreeChangeEnricher {
    private readonly schema;
    private readonly idCompressor?;
    private readonly onEnrichCommit?;
    private readonly onRefresherAdded?;
    private readonly onForkState?;
    private readonly onApplyChange?;
    /**
     * Queue of changes to be applied before querying for detached roots.
     */
    private readonly changeQueue;
    protected readonly borrowed: BorrowedState;
    protected owned?: OwnedState;
    /**
     * @param borrowedForest - The state based on which to enrich changes.
     * Not owned by the constructed instance.
     * @param schema - The schema that corresponds to the forest.
     * @param borrowedRemovedRoots - The set of removed roots based on which to enrich changes.
     * Not owned by the constructed instance.
     * @param idCompressor - The id compressor to use when chunking trees.
     * @param onEnrichCommit - Optional callback invoked whenever a commit is enriched.
     * @param onRefresherAdded - Optional callback invoked whenever a refresher is added during enrichment.
     * @param onForkState - Optional callback invoked whenever the enricher forks its state.
     * @param onApplyChange - Optional callback invoked whenever a change is applied to the owned state.
     */
    constructor(borrowedForest: IForestSubscription, borrowedRemovedRoots: ReadOnlyDetachedFieldIndex, schema: TreeStoredSchemaRepository, idCompressor?: IIdCompressor | undefined, onEnrichCommit?: (() => void) | undefined, onRefresherAdded?: (() => void) | undefined, onForkState?: (() => void) | undefined, onApplyChange?: (() => void) | undefined);
    enrich(change: SharedTreeChange): SharedTreeChange;
    private getDetachedRoot;
    enqueueChange(change: TaggedChange<SharedTreeChange> | (() => TaggedChange<SharedTreeChange>)): void;
    private purgeChangeQueue;
    [disposeSymbol](): void;
}
export {};
//# sourceMappingURL=sharedTreeChangeEnricher.d.ts.map