/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { FieldKey } from "../core/index.js";
import { Context, FlexFieldSchema, FlexTreeContext, FlexTreeSchema, FlexTreeTypedField, NodeKeyManager } from "../feature-libraries/index.js";
import { IDisposable, disposeSymbol } from "../util/index.js";
import { ITreeCheckout, ITreeCheckoutFork, TreeCheckout } from "./treeCheckout.js";
/**
 * An editable view of a (version control style) branch of a shared tree.
 * @privateRemarks
 * TODO:
 * 1. Once ISharedTreeView is renamed this can become ISharedTreeView.
 * 2. This object should be combined with or accessible from the TreeContext to allow easy access to thinks like branching.
 * @internal
 */
export interface FlexTreeView<in out TRoot extends FlexFieldSchema> extends IDisposable {
    /**
     * Context for controlling the FlexTree nodes produced from {@link FlexTreeView.flexTree}.
     *
     * @remarks
     * This is an owning reference: disposing of this view disposes its context.
     */
    readonly context: FlexTreeContext;
    /**
     * Access non-view schema specific aspects of of this branch.
     *
     * @remarks
     * This is a non-owning reference: disposing of this view does not impact the branch.
     */
    readonly checkout: ITreeCheckout;
    /**
     * Get a typed view of the tree content using the editable-tree-2 API.
     */
    readonly flexTree: FlexTreeTypedField<TRoot>;
    /**
     * Spawn a new view which is based off of the current state of this view.
     * Any mutations of the new view will not apply to this view until the new view is merged back into this view via `merge()`.
     */
    fork(): ITreeViewFork<TRoot>;
}
/**
 * Branch (like in a version control system) of SharedTree.
 *
 * {@link FlexTreeView} that has forked off of the main trunk/branch.
 * @internal
 */
export interface ITreeViewFork<in out TRoot extends FlexFieldSchema> extends FlexTreeView<TRoot> {
    readonly checkout: ITreeCheckoutFork;
}
/**
 * Implementation of FlexTreeView wrapping a ITreeCheckout.
 */
export declare class CheckoutFlexTreeView<in out TRoot extends FlexFieldSchema, out TCheckout extends TreeCheckout = TreeCheckout> implements FlexTreeView<TRoot> {
    readonly checkout: TCheckout;
    readonly schema: FlexTreeSchema<TRoot>;
    readonly nodeKeyManager: NodeKeyManager;
    readonly nodeKeyFieldKey: FieldKey;
    private readonly onDispose?;
    readonly context: Context;
    readonly flexTree: FlexTreeTypedField<TRoot>;
    constructor(checkout: TCheckout, schema: FlexTreeSchema<TRoot>, nodeKeyManager: NodeKeyManager, nodeKeyFieldKey: FieldKey, onDispose?: (() => void) | undefined);
    [disposeSymbol](): void;
    fork(): CheckoutFlexTreeView<TRoot, TreeCheckout & ITreeCheckoutFork>;
}
/**
 * Maps the context of every {@link CheckoutFlexTreeView} to the view.
 * In practice, this allows the view or checkout to be obtained from a flex node by first getting the context from the flex node and then using this map.
 */
export declare const contextToTreeView: WeakMap<Context, CheckoutFlexTreeView<any, TreeCheckout>>;
//# sourceMappingURL=treeView.d.ts.map