/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { Type } from "@sinclair/typebox";
import { EncodedChangeAtomId } from "../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).
export const EncodedRegisterId = Type.Union([EncodedChangeAtomId, Type.Literal(0)]);
export const EncodedBuild = Type.Tuple([EncodedChangeAtomId]);
export const EncodedOptionalChangeset = (tNodeChange) => Type.Object({
    b: Type.Optional(Type.Array(EncodedBuild)),
    m: Type.Optional(Type.Array(Type.Tuple([
        EncodedRegisterId,
        EncodedRegisterId,
        Type.Optional(Type.Boolean()),
    ]))),
    c: Type.Optional(Type.Array(Type.Tuple([EncodedRegisterId, tNodeChange]))),
    d: Type.Optional(EncodedRegisterId),
}, noAdditionalProps);
//# sourceMappingURL=optionalFieldChangeFormat.js.map