/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { assert } from "@fluidframework/core-utils/internal";
/**
 * Checks if the input is an {@link AnnotatedAllowedTypes}.
 */
export function isAnnotatedAllowedTypes(allowedTypes) {
    return (
    // Class based schema, and lazy schema references report type "function": filtering them out with typeof makes narrowing based on members mostly safe
    typeof allowedTypes === "object" && "metadata" in allowedTypes && "types" in allowedTypes);
}
/**
 * Downcasts a {@link TreeNodeSchemaCore} to {@link TreeNodeSchemaCorePrivate} if it is one.
 *
 * @remarks
 * This function should only be used internally. The result should not be exposed publicly
 * in any exported types or API return values.
 */
export function asTreeNodeSchemaCorePrivate(schema) {
    assert("childAnnotatedAllowedTypes" in schema, 0xbc9 /* All implementations of TreeNodeSchemaCore must also implement TreeNodeSchemaCorePrivate */);
    assert(Array.isArray(schema.childAnnotatedAllowedTypes), 0xbca /* All implementations of TreeNodeSchemaCore must also implement TreeNodeSchemaCorePrivate */);
    return schema;
}
/**
 * Kind of tree node.
 * @remarks
 * More kinds may be added over time, so do not assume this is an exhaustive set.
 * @public
 */
export var NodeKind;
(function (NodeKind) {
    /**
     * A node which serves as a map, storing children under string keys.
     */
    NodeKind[NodeKind["Map"] = 0] = "Map";
    /**
     * A node which serves as an array, storing children in an ordered sequence.
     */
    NodeKind[NodeKind["Array"] = 1] = "Array";
    /**
     * A node which stores a heterogenous collection of children in named fields.
     * @remarks
     * Each field gets its own schema.
     */
    NodeKind[NodeKind["Object"] = 2] = "Object";
    /**
     * A node which stores a single leaf value.
     */
    NodeKind[NodeKind["Leaf"] = 3] = "Leaf";
})(NodeKind || (NodeKind = {}));
//# sourceMappingURL=treeNodeSchema.js.map