/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { ICodecFamily } from "../codec";
import { ChangeFamily, ProgressiveEditBuilder, ChangeRebaser, AnchorSet, Delta, UpPath, Value, ITreeCursor, RevisionTag, ChangeFamilyEditor, FieldUpPath } from "../core";
import { ModularChangeset, NodeReviver } from "./modular-schema";
export declare 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;
    constructor();
    get rebaser(): ChangeRebaser<DefaultChangeset>;
    get codecs(): ICodecFamily<DefaultChangeset>;
    intoDelta(change: DefaultChangeset): Delta.Root;
    buildEditor(changeReceiver: (change: DefaultChangeset) => void, anchorSet: AnchorSet): DefaultEditBuilder;
}
export declare const defaultChangeFamily: DefaultChangeFamily;
/**
 * Default editor for transactions.
 * @alpha
 */
export interface IDefaultEditBuilder {
    setValue(path: UpPath, value: Value): void;
    /**
     * @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
     * @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): SequenceFieldEditBuilder;
    move(sourceField: FieldUpPath, sourceIndex: number, count: number, destinationField: FieldUpPath, destIndex: number): void;
    addValueConstraint(path: UpPath, value: Value): void;
}
/**
 * Implementation of {@link ProgressiveEditBuilder} based on the default set of supported field kinds.
 * @sealed
 */
export declare class DefaultEditBuilder implements ProgressiveEditBuilder<DefaultChangeset>, IDefaultEditBuilder {
    private readonly modularBuilder;
    constructor(family: ChangeFamily<ChangeFamilyEditor, DefaultChangeset>, changeReceiver: (change: DefaultChangeset) => void, anchors: AnchorSet);
    enterTransaction(): void;
    exitTransaction(): void;
    apply(change: DefaultChangeset): void;
    setValue(path: UpPath, value: Value): void;
    addValueConstraint(path: UpPath, value: Value): void;
    valueField(field: FieldUpPath): ValueFieldEditBuilder;
    optionalField(field: FieldUpPath): OptionalFieldEditBuilder;
    move(sourceField: FieldUpPath, sourceIndex: number, count: number, destinationField: FieldUpPath, destIndex: number): void;
    sequenceField(field: FieldUpPath): SequenceFieldEditBuilder;
    /**
     * {@inheritDoc (ProgressiveEditBuilder:interface).getChanges}
     */
    getChanges(): DefaultChangeset[];
}
/**
 * @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
     */
    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
     * @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
     */
    insert(index: number, newContent: ITreeCursor | 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 after removing the moving elements.
     */
    move(sourceIndex: number, count: number, destIndex: number): void;
    /**
     * Revives a contiguous range of deleted nodes.
     * @param index - The index at which to revive the node (this will become the index of the first revived node).
     * @param count - The number of nodes to revive.
     * @param detachedBy - The revision of the edit that deleted the nodes.
     * @param reviver - The NodeReviver used to retrieve repair data.
     * @param detachIndex - The index of the first node to revive in the input context of edit `detachedBy`.
     * @param isIntention - If true, the node will be revived even if edit `detachedBy` did not ultimately
     * delete them. If false, only those nodes that were deleted by `detachedBy` (and not revived) will be revived.
     */
    revive(index: number, count: number, detachedBy: RevisionTag, reviver: NodeReviver, detachIndex: number, isIntention?: true): void;
}
//# sourceMappingURL=defaultChangeFamily.d.ts.map