"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.FluidSerializableAsTree = void 0;
const index_js_1 = require("./simple-tree/index.js");
const sf = new index_js_1.SchemaFactory("com.fluidframework.serializable");
/**
 * Utilities for storing {@link FluidSerializableAsTree.Data|Fluid Serializable data} in {@link TreeNode}s.
 *
 * Same as {@link JsonAsTree} except allows {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}s.
 * @remarks
 * Schema which replicate the Fluid Serializable data model with {@link TreeNode}s.
 *
 * Fluid Serializable data can be imported from the {@link FluidSerializableAsTree.Data|Fluid Serializable format} into this format using {@link (TreeAlpha:interface).importConcise} with the {@link FluidSerializableAsTree.(Tree:variable)} schema.
 * @internal
 */
var FluidSerializableAsTree;
(function (FluidSerializableAsTree) {
    /**
     * {@link AllowedTypes} for any content allowed in the {@link FluidSerializableAsTree} domain.
     * @example
     * ```typescript
     * const tree = TreeAlpha.importConcise(FluidSerializableAsTree.Tree, { example: { nested: true }, value: 5 });
     * ```
     * @internal
     */
    FluidSerializableAsTree.Tree = [
        () => FluidSerializableObject,
        () => Array,
        ...index_js_1.SchemaFactory.leaves,
    ];
    /**
     * Do not use. Exists only as a workaround for {@link https://github.com/microsoft/TypeScript/issues/59550} and {@link https://github.com/microsoft/rushstack/issues/4429}.
     * @system @internal
     */
    FluidSerializableAsTree._APIExtractorWorkaroundObjectBase = sf.mapRecursive("object", FluidSerializableAsTree.Tree);
    /**
     * Arbitrary Fluid Serializable object as a {@link TreeNode}.
     * @remarks
     * API of the tree node is more aligned with an es6 map than a JS object using its properties like a map.
     * @example
     * ```typescript
     * // Due to TypeScript restrictions on recursive types, the constructor and be somewhat limiting.
     * const fromArray = new JsonAsTreeObject([["a", 0]]);
     * // Using `importConcise` can work better for Fluid Serializable data:
     * const imported = TreeAlpha.importConcise(FluidSerializableAsTree.Object, { a: 0 });
     * // Node API is like a Map:
     * const value = imported.get("a");
     * ```
     * @privateRemarks
     * Due to https://github.com/microsoft/TypeScript/issues/61270 this can't be named `Object`.
     * @sealed @internal
     */
    class FluidSerializableObject extends FluidSerializableAsTree._APIExtractorWorkaroundObjectBase {
    }
    FluidSerializableAsTree.FluidSerializableObject = FluidSerializableObject;
    {
    }
    /**
     * Do not use. Exists only as a workaround for {@link https://github.com/microsoft/TypeScript/issues/59550} and {@link https://github.com/microsoft/rushstack/issues/4429}.
     * @system @internal
     */
    FluidSerializableAsTree._APIExtractorWorkaroundArrayBase = sf.arrayRecursive("array", FluidSerializableAsTree.Tree);
    /**
     * Arbitrary Fluid Serializable array as a {@link TreeNode}.
     * @remarks
     * This can be imported using {@link (TreeAlpha:interface).importConcise}.
     * @example
     * ```typescript
     * // Due to TypeScript restrictions on recursive types, the constructor can be somewhat limiting.
     * const usingConstructor = new FluidSerializableAsTree.Array(["a", 0, new FluidSerializableAsTree.Array([1])]);
     * // Using `importConcise` can work better for Fluid Serializable data:
     * const imported = TreeAlpha.importConcise(FluidSerializableAsTree.Array, ["a", 0, [1]]);
     * // Node API is like an Array:
     * const inner: FluidSerializableAsTree.Tree = imported[2];
     * assert(Tree.is(inner, FluidSerializableAsTree.Array));
     * const leaf = inner[0];
     * ```
     * @sealed @internal
     */
    class Array extends FluidSerializableAsTree._APIExtractorWorkaroundArrayBase {
    }
    FluidSerializableAsTree.Array = Array;
    {
    }
})(FluidSerializableAsTree || (exports.FluidSerializableAsTree = FluidSerializableAsTree = {}));
//# sourceMappingURL=serializableDomainSchema.js.map