/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { makeSchemaCodec } from "../schema-index/index.js";
import { EncodedSchemaChange } from "./schemaChangeFormat.js";
export function makeSchemaChangeCodec({ jsonValidator: validator, }) {
    const schemaCodec = makeSchemaCodec({ jsonValidator: validator });
    return {
        encode: (schemaChange) => {
            return {
                new: schemaCodec.encode(schemaChange.schema.new),
                old: schemaCodec.encode(schemaChange.schema.old),
            };
        },
        decode: (encoded) => {
            return {
                schema: {
                    new: schemaCodec.decode(encoded.new),
                    old: schemaCodec.decode(encoded.old),
                },
            };
        },
        encodedSchema: EncodedSchemaChange,
    };
}
//# sourceMappingURL=schemaChangeCodecs.js.map