/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { type ICodecOptions } from "../../codec/index.js";
import { type Brand, type IdAllocator, type JsonCompatibleReadOnly } from "../../util/index.js";
import type { RevisionTagCodec } from "../rebase/index.js";
import type { FieldKey } from "../schema-stored/index.js";
import type * as Delta from "./delta.js";
import type { Major } from "./detachedFieldIndexTypes.js";
import type { IIdCompressor } from "@fluidframework/id-compressor";
/**
 * ID used to create a detached field key for a removed subtree.
 *
 * TODO: Move to Forest once forests can support multiple roots.
 * @internal
 */
export type ForestRootId = Brand<number, "tree.ForestRootId">;
/**
 * The tree index records detached field IDs and associates them with a change atom ID.
 */
export declare class DetachedFieldIndex {
    private readonly name;
    private rootIdAllocator;
    private readonly revisionTagCodec;
    private readonly idCompressor;
    private detachedNodeToField;
    private readonly codec;
    private readonly options;
    /**
     * @param name - A name for the index, used as a prefix for the generated field keys.
     * @param rootIdAllocator - An ID allocator used to generate unique field keys.
     */
    constructor(name: string, rootIdAllocator: IdAllocator<ForestRootId>, revisionTagCodec: RevisionTagCodec, idCompressor: IIdCompressor, options?: ICodecOptions);
    clone(): DetachedFieldIndex;
    entries(): Generator<{
        root: ForestRootId;
    } & {
        id: Delta.DetachedNodeId;
    }>;
    /**
     * Removes all entries from the index.
     */
    purge(): void;
    updateMajor(current: Major, updated: Major): void;
    /**
     * Returns a field key for the given ID.
     * This does not save the field key on the index. To do so, call {@link createEntry}.
     */
    toFieldKey(id: ForestRootId): FieldKey;
    /**
     * Returns the FieldKey associated with the given id.
     * Returns undefined if no such id is known to the index.
     */
    tryGetEntry(id: Delta.DetachedNodeId): ForestRootId | undefined;
    /**
     * Returns the FieldKey associated with the given id.
     * Fails if no such id is known to the index.
     */
    getEntry(id: Delta.DetachedNodeId): ForestRootId;
    deleteEntry(nodeId: Delta.DetachedNodeId): void;
    /**
     * Associates the DetachedNodeId with a field key and creates an entry for it in the index.
     */
    createEntry(nodeId?: Delta.DetachedNodeId, count?: number): ForestRootId;
    encode(): JsonCompatibleReadOnly;
    /**
     * Loads the tree index from the given string, this overrides any existing data.
     */
    loadData(data: JsonCompatibleReadOnly): void;
}
//# sourceMappingURL=detachedFieldIndex.d.ts.map