/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
/* eslint-disable no-inner-declarations */
import { SchemaBuilder } from "../../../domains/index.js";
import { FieldKinds, FlexFieldSchema, } from "../../../feature-libraries/index.js";
const builder = new SchemaBuilder({ scope: "Complex Schema Example" });
// Schema
export const stringTaskSchema = builder.fieldNode("StringTask", builder.string);
// Polymorphic recursive schema:
export const listTaskSchema = builder.objectRecursive("ListTask", {
    items: FlexFieldSchema.createUnsafe(FieldKinds.sequence, [
        stringTaskSchema,
        () => listTaskSchema,
    ]),
});
{
}
export const rootFieldSchema = SchemaBuilder.required([stringTaskSchema, listTaskSchema]);
export const appSchemaData = builder.intoSchema(rootFieldSchema);
// Example Use
{
    const stringTask = "do it";
    const task1 = "do it";
    const task2 = {
        items: ["FHL", "record video"],
    };
    // const task3: FlexibleTask = {
    // 	[typeNameSymbol]: stringTaskSchema.name,
    // 	x: 1,
    // };
    function makeTask(tasks) {
        if (tasks.length === 1) {
            return tasks[0];
        }
        return { items: tasks.map((s) => s) };
    }
}
//# sourceMappingURL=schemaComplex.js.map