/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { anchorSlot, } from "../../core/index.js";
/**
 * An anchor slot which records the {@link FlexTreeNode} associated with that anchor, if there is one.
 * @remarks This always points to a "real" {@link FlexTreeNode} (i.e. a `LazyTreeNode`), never to a "raw" node.
 */
export const flexTreeSlot = anchorSlot();
/**
 * Indicates that an object is a flex tree.
 */
export const flexTreeMarker = Symbol("flexTreeMarker");
function isFlexTreeEntity(t) {
    return typeof t === "object" && t !== null && flexTreeMarker in t;
}
export function isFlexTreeNode(t) {
    return isFlexTreeEntity(t) && t[flexTreeMarker] === FlexTreeEntityKind.Node;
}
export var FlexTreeEntityKind;
(function (FlexTreeEntityKind) {
    FlexTreeEntityKind[FlexTreeEntityKind["Node"] = 0] = "Node";
    FlexTreeEntityKind[FlexTreeEntityKind["Field"] = 1] = "Field";
})(FlexTreeEntityKind || (FlexTreeEntityKind = {}));
/**
 * Status of the tree that a particular node belongs to.
 * @public
 */
export var TreeStatus;
(function (TreeStatus) {
    /**
     * Is parented under the root field.
     */
    TreeStatus[TreeStatus["InDocument"] = 0] = "InDocument";
    /**
     * Is not parented under the root field, but can be added back to the original document tree.
     */
    TreeStatus[TreeStatus["Removed"] = 1] = "Removed";
    /**
     * Is removed and cannot be added back to the original document tree.
     * @remarks
     * Nodes can enter this state for multiple reasons:
     * - The node was removed and nothing (e.g. undo/redo history) kept it from being cleaned up.
     * - The {@link TreeView} was disposed or had a schema change which made the tree incompatible.
     *
     * Deleted nodes' contents should not be observed or edited. This includes functionality exposed via {@link (Tree:variable)},
     * with the exception of {@link TreeNodeApi.status}.
     *
     * @privateRemarks
     * There was planned work (AB#17948) to make the first reason a node could become "Deleted" impossible,
     * at least as an opt in feature,
     * by lifetime extending all nodes which are still possible to reach automatically.
     */
    TreeStatus[TreeStatus["Deleted"] = 2] = "Deleted";
    /**
     * Is created but has not yet been inserted into the tree.
     * @remarks
     * See also {@link Unhydrated}.
     *
     * Nodes in the new state have some limitations:
     *
     * - Events are not currently triggered for changes. Fixes for this are planned.
     *
     * - Reading identifiers from nodes which were left unspecified (defaulted) when creating the tree will error.
     * This is because allocating unique identifiers in a compressible manner requires knowing which tree the nodes will be inserted into.
     *
     * - Transactions do not work: transactions apply to a single {@link TreeView}, and `New` nodes are not part of one.
     *
     * - Automatically generated {@link SchemaFactory.identifier | identifiers} will be less compressible if read.
     *
     * - {@link TreeIdentifierUtils.getShort} and {@link TreeNodeApi.shortId | Tree.shortId} cannot return their short identifiers.
     */
    TreeStatus[TreeStatus["New"] = 3] = "New";
})(TreeStatus || (TreeStatus = {}));
//# sourceMappingURL=flexTreeTypes.js.map