/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { FieldKey, TreeNodeSchemaIdentifier } from "../core";
import { EditableTreeEvents, FieldNodeSchema, FlexTreeContext, FlexTreeField, FlexTreeNode, FlexTreeTypedNode, FlexTreeEntityKind, FlexTreeMapNode, FlexTreeObjectNode, FlexTreeTypedField, FlexTreeUnboxField, FlexibleFieldContent, boxedIterator, flexTreeMarker, onNextChange, LocalNodeKey, MapNodeSchema, ObjectNodeSchema, TreeNodeSchema, TreeStatus, FlexTreeFieldNode } from "../feature-libraries";
import { InsertableTypedNode } from "./insertable";
/** Stores the content of the raw node, i.e. the data that was passed to the factory */
declare const nodeContent: unique symbol;
interface HasNodeContent<T> {
    [nodeContent]: T;
}
/**
 * Retrieve the content of a raw object node created via {@link createRawNode}.
 * @remarks
 * Raw nodes should only ever be processed as input once.
 * Therefore, this extraction removes the content from the node and will error if called twice on the same node.
 */
export declare function extractRawNodeContent<TSchema extends MapNodeSchema, TContent extends InsertableTypedNode<TSchema>>(node: RawMapNode<TSchema, TContent>): TContent;
export declare function extractRawNodeContent<TSchema extends FieldNodeSchema, TContent extends InsertableTypedNode<TSchema>>(node: RawFieldNode<TSchema, TContent>): TContent;
export declare function extractRawNodeContent<TSchema extends ObjectNodeSchema, TContent extends object>(node: RawObjectNode<TSchema, TContent>): TContent;
export declare function extractRawNodeContent(node: FlexTreeNode): object | undefined;
/**
 * Creates a node that pretends to satisfy the given schema while wrapping the given node content.
 * Retrieve the node content via {@link extractRawNodeContent}.
 *
 * @remarks This is useful for creating "raw" nodes: nodes which capture data about a pending insertion but are not yet inserted.
 * These raw nodes can be then used on the right-hand side of an assignment (via `=`) to the tree.
 * However, many of their properties and methods are currently unimplemented and will error if accessed.
 */
export declare function createRawNode<TSchema extends MapNodeSchema, TContent extends InsertableTypedNode<TSchema>>(schema: TSchema, content: TContent): RawMapNode<TSchema, TContent>;
export declare function createRawNode<TSchema extends FieldNodeSchema, TContent extends InsertableTypedNode<TSchema>>(schema: TSchema, content: TContent): RawFieldNode<TSchema, TContent>;
export declare function createRawNode<TSchema extends ObjectNodeSchema, TContent extends InsertableTypedNode<TSchema>>(schema: TSchema, content: TContent): RawObjectNode<TSchema, TContent>;
/**
 * The base implementation of a node created by {@link createRawNode}.
 */
export declare abstract class RawTreeNode<TSchema extends TreeNodeSchema, TContent> implements FlexTreeNode, HasNodeContent<TContent> {
    readonly schema: TSchema;
    readonly [flexTreeMarker]: FlexTreeEntityKind.Node;
    readonly [nodeContent]: TContent;
    readonly type: TreeNodeSchemaIdentifier;
    constructor(schema: TSchema, content: TContent);
    get context(): FlexTreeContext;
    get parentField(): {
        parent: FlexTreeField;
        index: number;
    };
    is<TSchemaInner extends TreeNodeSchema>(schema: TSchemaInner): this is FlexTreeTypedNode<TSchemaInner>;
    tryGetField(key: FieldKey): FlexTreeField | undefined;
    [boxedIterator](): IterableIterator<FlexTreeField>;
    treeStatus(): TreeStatus;
    value: undefined;
    on<K extends keyof EditableTreeEvents>(eventName: K, listener: EditableTreeEvents[K]): () => void;
    [onNextChange](fn: (node: FlexTreeNode) => void): () => void;
}
/**
 * The implementation of an object node created by {@link createRawNode}.
 */
export declare class RawObjectNode<TSchema extends ObjectNodeSchema, TContent extends object> extends RawTreeNode<TSchema, TContent> implements FlexTreeObjectNode {
    get localNodeKey(): LocalNodeKey | undefined;
}
/**
 * The implementation of a map node created by {@link createRawNode}.
 */
export declare class RawMapNode<TSchema extends MapNodeSchema, TContent extends InsertableTypedNode<TSchema>> extends RawTreeNode<TSchema, TContent> implements FlexTreeMapNode<TSchema> {
    get size(): number;
    has(key: string): boolean;
    get(key: string): FlexTreeUnboxField<TSchema["info"]>;
    getBoxed(key: string): FlexTreeTypedField<TSchema["info"]>;
    keys(): IterableIterator<FieldKey>;
    values(): IterableIterator<FlexTreeUnboxField<TSchema["info"], "notEmpty">>;
    entries(): IterableIterator<[
        FieldKey,
        FlexTreeUnboxField<TSchema["info"], "notEmpty">
    ]>;
    forEach(callbackFn: (value: FlexTreeUnboxField<TSchema["info"], "notEmpty">, key: FieldKey, map: FlexTreeMapNode<TSchema>) => void, thisArg?: any): void;
    set(key: string, value: FlexibleFieldContent<TSchema["info"]> | undefined): void;
    delete(key: string): void;
    get asObject(): {
        readonly [P in FieldKey]?: FlexTreeUnboxField<TSchema["info"], "notEmpty">;
    };
    [Symbol.iterator](): IterableIterator<[
        FieldKey,
        FlexTreeUnboxField<TSchema["info"], "notEmpty">
    ]>;
    [boxedIterator](): IterableIterator<FlexTreeTypedField<TSchema["info"]>>;
}
/**
 * The implementation of a field node created by {@link createRawNode}.
 */
export declare class RawFieldNode<TSchema extends FieldNodeSchema, TContent extends InsertableTypedNode<TSchema>> extends RawTreeNode<TSchema, TContent> implements FlexTreeFieldNode<TSchema> {
    get content(): FlexTreeUnboxField<TSchema["info"]>;
    get boxedContent(): FlexTreeTypedField<TSchema["info"]>;
}
export {};
//# sourceMappingURL=rawNode.d.ts.map