"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeSchemaChangeCodec = void 0;
const index_js_1 = require("../schema-index/index.js");
const schemaChangeFormat_js_1 = require("./schemaChangeFormat.js");
function makeSchemaChangeCodec({ jsonValidator: validator, }) {
    const schemaCodec = (0, index_js_1.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: schemaChangeFormat_js_1.EncodedSchemaChange,
    };
}
exports.makeSchemaChangeCodec = makeSchemaChangeCodec;
//# sourceMappingURL=schemaChangeCodecs.js.map