"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 schema_index_1 = require("../schema-index");
const schemaChangeFormat_1 = require("./schemaChangeFormat");
function makeSchemaChangeCodec({ jsonValidator: validator, }) {
    const schemaCodec = (0, schema_index_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_1.EncodedSchemaChange,
    };
}
exports.makeSchemaChangeCodec = makeSchemaChangeCodec;
//# sourceMappingURL=schemaChangeCodecs.js.map