"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.TreeStatus = exports.FlexTreeEntityKind = exports.isFlexTreeNode = exports.flexTreeMarker = exports.flexTreeSlot = void 0;
const index_js_1 = require("../../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.
 */
exports.flexTreeSlot = (0, index_js_1.anchorSlot)();
/**
 * Indicates that an object is a flex tree.
 */
exports.flexTreeMarker = Symbol("flexTreeMarker");
function isFlexTreeEntity(t) {
    return typeof t === "object" && t !== null && exports.flexTreeMarker in t;
}
function isFlexTreeNode(t) {
    return isFlexTreeEntity(t) && t[exports.flexTreeMarker] === FlexTreeEntityKind.Node;
}
exports.isFlexTreeNode = isFlexTreeNode;
/**
 */
var FlexTreeEntityKind;
(function (FlexTreeEntityKind) {
    FlexTreeEntityKind[FlexTreeEntityKind["Node"] = 0] = "Node";
    FlexTreeEntityKind[FlexTreeEntityKind["Field"] = 1] = "Field";
})(FlexTreeEntityKind || (exports.FlexTreeEntityKind = FlexTreeEntityKind = {}));
/**
 * Status of the tree that a particular node belongs to.
 * @public
 */
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.
     */
    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.
     *
     * - `Tree.shortId` (when the identifier was explicitly specified and thus works at all) will just return the full identifier as a string,
     * but might return a compressed form as a number once hydrated.
     */
    TreeStatus[TreeStatus["New"] = 3] = "New";
})(TreeStatus || (exports.TreeStatus = TreeStatus = {}));
//# sourceMappingURL=flexTreeTypes.js.map