/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { ChangeFamily, ChangeFamilyEditor } from "../change-family";
import { GraphCommit, RevisionTag } from "../rebase";
/**
 * Manages a branch of the undoable/redoable commit trees and repair data associated with the undoable and redoable commits.
 */
export declare class UndoRedoManager<TChange, TEditor extends ChangeFamilyEditor> {
    private readonly changeFamily;
    private headUndoableCommit?;
    private headRedoableCommit?;
    private readonly commitTypes;
    /**
     * @param changeFamily - {@link ChangeFamily} used for inverting changes.
     * @param headUndoableCommit - Optional commit to set as the initial undoable commit.
     * @param headRedoableCommit - Optional commit to set as the initial redoable commit.
     */
    static create<TChange, TEditor extends ChangeFamilyEditor>(changeFamily: ChangeFamily<TEditor, TChange>, headUndoableCommit?: ReversibleCommit<TChange>, headRedoableCommit?: ReversibleCommit<TChange>): UndoRedoManager<TChange, TEditor>;
    private constructor();
    get headUndoable(): ReversibleCommit<TChange> | undefined;
    get headRedoable(): ReversibleCommit<TChange> | undefined;
    /**
     * Adds the provided commit to the undo or redo commit tree, depending on the type of commit it is.
     * Should be called for all commits on the relevant branch, including undo and redo commits.
     */
    trackCommit(commit: GraphCommit<TChange>, type: LocalCommitSource): void;
    /**
     * Returns the {@link LocalCommitSource} associated with the provided revision.
     */
    getCommitType(revision: RevisionTag): LocalCommitSource | undefined;
    /**
     * Removes the {@link LocalCommitSource} associated with the provided revision.
     */
    untrackCommitType(revision: RevisionTag): void;
    /**
     * Inverts the head undoable commit and returns the inverted change.
     * This change can then be applied and tracked.
     * @param headCommit - The head commit of the branch to undo from.
     */
    undo(headCommit: GraphCommit<TChange>): TChange | undefined;
    /**
     * Inverts the head redoable commit and returns the inverted change.
     * This change can then be applied and tracked.
     * @param headCommit - The head commit of the branch to redo from.
     */
    redo(headCommit: GraphCommit<TChange>): TChange | undefined;
    private createInvertedChange;
    /**
     * Creates a copy of this `UndoRedoManager`.
     * @param headUndoableCommit - Optional head undoable commit, if one is not provided the head undoable commit
     * of this {@link UndoRedoManager} will be used.
     * @param headRedoableCommit - Optional head redoable commit, if one is not provided the head redoable commit
     * of this {@link UndoRedoManager} will be used.
     */
    clone(headUndoableCommit?: ReversibleCommit<TChange>, headRedoableCommit?: ReversibleCommit<TChange>): UndoRedoManager<TChange, TEditor>;
    /**
     * Updates the state of this {@link UndoRedoManager} to correctly reference commits that have been rebased after merging.
     * @param newCommits - all commits which were appended to the source branch.
     * @param mergedUndoRedoManager - the {@link UndoRedoManager} of the branch that was merged.
     */
    updateAfterMerge(newCommits: GraphCommit<TChange>[], mergedUndoRedoManager: UndoRedoManager<TChange, TEditor>): void;
    /**
     * Updates the state of this {@link UndoRedoManager} to correctly reference commits that have been rebased.
     * @param newCommits - all commits from the original branch that have rebased versions present on the new branch.
     * @param baseUndoRedoManager - the {@link UndoRedoManager} of the branch that was rebased onto
     */
    updateAfterRebase(newCommits: GraphCommit<TChange>[], baseUndoRedoManager: UndoRedoManager<TChange, TEditor>): void;
    private updateBasedOnNewCommits;
}
/**
 * Represents a commit that can be undone.
 */
export interface ReversibleCommit<TChange> {
    commit: GraphCommit<TChange>;
    readonly parent?: ReversibleCommit<TChange>;
}
/**
 * The source of a local commit.
 *
 * @alpha
 */
export declare enum LocalCommitSource {
    /** A typical local commit */
    Default = 0,
    /** A commit that is the result of an undo. */
    Undo = 1,
    /** A commit that is the result of a redo. */
    Redo = 2
}
//# sourceMappingURL=undoRedoManager.d.ts.map