"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyDiscussionMigrations = applyDiscussionMigrations;
const defaults_1 = require("../defaults");
const migrateDiscussionSlugAndOrgUrlKey_1 = require("./migrateDiscussionSlugAndOrgUrlKey");
/**
 * Apply discussion migrations.
 * Exported for testing purposes. This is not exported from the main module.
 * @param discussion
 * @returns
 */
function applyDiscussionMigrations(discussion) {
    // Ensure the orgUrlKey is lowercase and the slug is updated accordingly
    if (discussion.schemaVersion === defaults_1.HUB_DISCUSSION_CURRENT_SCHEMA_VERSION) {
        return discussion;
    }
    // Apply the migrations
    const migrated = (0, migrateDiscussionSlugAndOrgUrlKey_1.migrateDiscussionSlugAndOrgUrlKey)(discussion);
    // add more migration here as needed
    // e.g. migrated = anotherMigration(migrated);
    return migrated;
}
//# sourceMappingURL=applyDiscussionMigrations.js.map