"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.EncodedOptionalChangeset = exports.EncodedBuild = exports.EncodedRegisterId = void 0;
const typebox_1 = require("@sinclair/typebox");
const core_1 = require("../../core");
const modular_schema_1 = require("../modular-schema");
const noAdditionalProps = { additionalProperties: false };
// 0 signifies "self". Using undefined doesn't actually JSON round-trip conveniently, since
// undefined is converted to null when inside an array (which happens in e.g. the moves array).
exports.EncodedRegisterId = typebox_1.Type.Union([modular_schema_1.EncodedChangeAtomId, typebox_1.Type.Literal(0)]);
exports.EncodedBuild = typebox_1.Type.Tuple([modular_schema_1.EncodedChangeAtomId, core_1.EncodedJsonableTree]);
const EncodedOptionalChangeset = (tNodeChange) => typebox_1.Type.Object({
    b: typebox_1.Type.Optional(typebox_1.Type.Array(exports.EncodedBuild)),
    m: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Tuple([
        exports.EncodedRegisterId,
        exports.EncodedRegisterId,
        typebox_1.Type.Optional(typebox_1.Type.Boolean()),
    ]))),
    c: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Tuple([exports.EncodedRegisterId, tNodeChange]))),
    d: typebox_1.Type.Optional(exports.EncodedRegisterId),
}, noAdditionalProps);
exports.EncodedOptionalChangeset = EncodedOptionalChangeset;
//# sourceMappingURL=optionalFieldChangeFormat.js.map