/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { Type } from "@sinclair/typebox";
import { unionOptions } from "../../codec/index.js";
import { brandedStringType } from "../../util/index.js";
/**
 * TypeBox Schema for encoding {@link FieldKey} in persisted data.
 */
export const FieldKeySchema = brandedStringType();
export const FieldKindIdentifierSchema = brandedStringType();
/**
 * TypeBox Schema for encoding {@link TreeNodeSchemaIdentifiers} in persisted data.
 */
export const TreeNodeSchemaIdentifierSchema = brandedStringType();
const FieldSchemaFormatBase = Type.Object({
    kind: FieldKindIdentifierSchema,
    types: Type.Array(TreeNodeSchemaIdentifierSchema),
});
const noAdditionalProps = { additionalProperties: false };
export const FieldSchemaFormat = Type.Composite([FieldSchemaFormatBase], noAdditionalProps);
/**
 * Persisted version of {@link ValueSchema}.
 */
export var PersistedValueSchema;
(function (PersistedValueSchema) {
    PersistedValueSchema[PersistedValueSchema["Number"] = 0] = "Number";
    PersistedValueSchema[PersistedValueSchema["String"] = 1] = "String";
    PersistedValueSchema[PersistedValueSchema["Boolean"] = 2] = "Boolean";
    PersistedValueSchema[PersistedValueSchema["FluidHandle"] = 3] = "FluidHandle";
    PersistedValueSchema[PersistedValueSchema["Null"] = 4] = "Null";
})(PersistedValueSchema || (PersistedValueSchema = {}));
/**
 * Discriminated union content of tree node schema.
 *
 * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.
 */
export const TreeNodeSchemaDataFormat = Type.Object({
    /**
     * Object node union member.
     */
    object: Type.Optional(Type.Record(Type.String(), FieldSchemaFormat)),
    /**
     * Map node union member.
     */
    map: Type.Optional(FieldSchemaFormat),
    /**
     * Leaf node union member.
     */
    leaf: Type.Optional(Type.Enum(PersistedValueSchema)),
}, unionOptions);
//# sourceMappingURL=formatV1.js.map