"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.nodeKeySchema = exports.nodeKeyField = exports.nodeKeyTreeSchema = void 0;
const internal_1 = require("@fluidframework/core-utils/internal");
const index_js_1 = require("../../core/index.js");
const index_js_2 = require("../../feature-libraries/index.js");
const builder = new index_js_2.SchemaBuilderInternal({ scope: "com.fluidframework.nodeKey" });
/**
 * Schema for a node which holds a {@link StableNodeKey}.
 *
 * @privateRemarks
 * This being a leaf may cause issues with leaf unboxing plans.
 * This might need to be changed to be a node holding a string node instead.
 */
exports.nodeKeyTreeSchema = builder.leaf("NodeKey", index_js_1.ValueSchema.String);
(0, internal_1.assert)(exports.nodeKeyTreeSchema.name === index_js_2.nodeKeyTreeIdentifier, 0x7ae /* mismatched identifiers */);
/**
 * Key and Field schema for working with {@link LocalNodeKey}s in a shared tree.
 * Node keys are added to object nodes via a field.
 * This object can be expanded into a schema to add the field.
 *
 * Requires including {@link nodeKeySchema}.
 */
exports.nodeKeyField = {
    [index_js_2.nodeKeyFieldKey]: index_js_2.FlexFieldSchema.create(index_js_2.FieldKinds.nodeKey, [exports.nodeKeyTreeSchema]),
};
/**
 * The schema library for working with {@link StableNodeKey}s in a tree.
 * Required to use {@link nodeKeyField}.
 */
exports.nodeKeySchema = builder.intoLibrary();
//# sourceMappingURL=nodeKeySchema.js.map