"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.SchemaBuilderInternal = void 0;
const schemaBuilderBase_js_1 = require("./schemaBuilderBase.js");
const index_js_1 = require("./default-schema/index.js");
const index_js_2 = require("./typed-schema/index.js");
/**
 * Extends {@link SchemaBuilderBase} with functionality only used to create built in special libraries.
 * Defaults to "required" fields.
 * @privateRemarks Should not be package exported.
 */
class SchemaBuilderInternal extends schemaBuilderBase_js_1.SchemaBuilderBase {
    constructor(options) {
        super(index_js_1.FieldKinds.required, options);
    }
    /**
     * Define (and add to this library) a {@link TreeNodeSchema} for a node that wraps a value.
     * Such nodes will be implicitly unwrapped to the value in some APIs.
     *
     * The name must be unique among all TreeNodeSchema in the the document schema.
     *
     * In addition to the normal properties of all nodes (having a schema for example),
     * Leaf nodes only contain a value.
     * Leaf nodes cannot have fields.
     *
     * TODO: Maybe ban undefined from allowed values here.
     * TODO: Decide and document how unwrapping works for non-primitive terminals.
     */
    leaf(name, t) {
        const schema = index_js_2.LeafNodeSchema.create(this, this.scoped(name), t);
        this.addNodeSchema(schema);
        return schema;
    }
}
exports.SchemaBuilderInternal = SchemaBuilderInternal;
//# sourceMappingURL=schemaBuilder.js.map