/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { ICodecFamily, ICodecOptions } from "../../codec";
import { ChangeFamily, ChangeRebaser, UpPath, ITreeCursor, ChangeFamilyEditor, FieldUpPath, TaggedChange, DeltaRoot, StoredSchemaCollection, DeltaDetachedNodeId } from "../../core";
import { ModularChangeset, FullSchemaPolicy } from "../modular-schema";
export type DefaultChangeset = ModularChangeset;
/**
 * Implementation of {@link ChangeFamily} based on the default set of supported field kinds.
 *
 * @sealed
 */
export declare class DefaultChangeFamily implements ChangeFamily<DefaultEditBuilder, DefaultChangeset> {
    private readonly modularFamily;
    static readonly emptyChange: DefaultChangeset;
    constructor(codecOptions: ICodecOptions);
    get rebaser(): ChangeRebaser<DefaultChangeset>;
    get codecs(): ICodecFamily<DefaultChangeset>;
    buildEditor(changeReceiver: (change: DefaultChangeset) => void): DefaultEditBuilder;
}
/**
 * @param change - The change to convert into a delta.
 */
export declare function intoDelta(taggedChange: TaggedChange<ModularChangeset>): DeltaRoot;
/**
 * Returns the set of removed roots that should be in memory for the given change to be applied.
 * A removed root is relevant if any of the following is true:
 * - It is being inserted
 * - It is being restored
 * - It is being edited
 * - The ID it is associated with is being changed
 *
 * May be conservative by returning more removed roots than strictly necessary.
 *
 * Will never return IDs for non-root trees, even if they are removed.
 *
 * @param change - The change to be applied.
 */
export declare function relevantRemovedRoots(taggedChange: TaggedChange<ModularChangeset>): Iterable<DeltaDetachedNodeId>;
/**
 * Default editor for transactions.
 * @alpha
 */
export interface IDefaultEditBuilder {
    /**
     * @param field - the value field which is being edited under the parent node
     * @returns An object with methods to edit the given field of the given parent.
     * The returned object can be used (i.e., have its methods called) multiple times but its lifetime
     * is bounded by the lifetime of this edit builder.
     */
    valueField(field: FieldUpPath): ValueFieldEditBuilder;
    /**
     * @param field - the optional field which is being edited under the parent node
     * @returns An object with methods to edit the given field of the given parent.
     * The returned object can be used (i.e., have its methods called) multiple times but its lifetime
     * is bounded by the lifetime of this edit builder.
     */
    optionalField(field: FieldUpPath): OptionalFieldEditBuilder;
    /**
     * @param field - the sequence field which is being edited under the parent node
     *
     * @param shapeInfo - optional shape information used for schema based chunk encoding.
     * TODO: The 'shapeInfo' parameter is a temporary solution enabling schema-based chunk encoding within this function.
     * This parameter should be removed once the encoded format is eventually separated out.
     *
     * @returns An object with methods to edit the given field of the given parent.
     * The returned object can be used (i.e., have its methods called) multiple times but its lifetime
     * is bounded by the lifetime of this edit builder.
     */
    sequenceField(field: FieldUpPath, shapeInfo?: {
        schema: StoredSchemaCollection;
        policy: FullSchemaPolicy;
    }): SequenceFieldEditBuilder;
    /**
     * Moves a subsequence from one sequence field to another sequence field.
     *
     * Note that the `destinationIndex` is interpreted based on the state of the sequence *before* the move operation.
     * For example, `move(field, 0, 1, field, 2)` changes `[A, B, C]` to `[B, A, C]`.
     */
    move(sourceField: FieldUpPath, sourceIndex: number, count: number, destinationField: FieldUpPath, destinationIndex: number): void;
    addNodeExistsConstraint(path: UpPath): void;
}
/**
 * Implementation of {@link IDefaultEditBuilder} based on the default set of supported field kinds.
 * @sealed
 */
export declare class DefaultEditBuilder implements ChangeFamilyEditor, IDefaultEditBuilder {
    private readonly modularBuilder;
    constructor(family: ChangeFamily<ChangeFamilyEditor, DefaultChangeset>, changeReceiver: (change: DefaultChangeset) => void);
    enterTransaction(): void;
    exitTransaction(): void;
    apply(change: DefaultChangeset): void;
    addNodeExistsConstraint(path: UpPath): void;
    valueField(field: FieldUpPath): ValueFieldEditBuilder;
    optionalField(field: FieldUpPath): OptionalFieldEditBuilder;
    move(sourceField: FieldUpPath, sourceIndex: number, count: number, destinationField: FieldUpPath, destIndex: number): void;
    sequenceField(field: FieldUpPath, shapeInfo?: {
        schema: StoredSchemaCollection;
        policy: FullSchemaPolicy;
    }): SequenceFieldEditBuilder;
}
/**
 * @alpha
 */
export interface ValueFieldEditBuilder {
    /**
     * Issues a change which replaces the current newContent of the field with `newContent`.
     * @param newContent - the new content for the field. Must be in Nodes mode.
     */
    set(newContent: ITreeCursor): void;
}
/**
 * @alpha
 */
export interface OptionalFieldEditBuilder {
    /**
     * Issues a change which replaces the current newContent of the field with `newContent`
     * @param newContent - the new content for the field. Must be in Nodes mode.
     * @param wasEmpty - whether the field is empty when creating this change
     */
    set(newContent: ITreeCursor | undefined, wasEmpty: boolean): void;
}
/**
 * @alpha
 */
export interface SequenceFieldEditBuilder {
    /**
     * Issues a change which inserts the `newContent` at the given `index`.
     * @param index - the index at which to insert the `newContent`.
     * @param newContent - the new content to be inserted in the field. Cursors must be in Nodes mode.
     */
    insert(index: number, newContent: ITreeCursor | readonly ITreeCursor[]): void;
    /**
     * Issues a change which deletes `count` elements starting at the given `index`.
     * @param index - The index of the first deleted element.
     * @param count - The number of elements to delete.
     */
    delete(index: number, count: number): void;
    /**
     * Issues a change which moves `count` elements starting at `sourceIndex` to `destIndex`.
     * @param sourceIndex - the index of the first moved element.
     * @param count - the number of elements to move.
     * @param destIndex - the index the elements are moved to, interpreted before detaching the moved elements.
     */
    move(sourceIndex: number, count: number, destIndex: number): void;
}
//# sourceMappingURL=defaultChangeFamily.d.ts.map