"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyInitiativeMigrations = applyInitiativeMigrations;
const migrateInvalidTimelineStages_1 = require("./migrateInvalidTimelineStages");
const defaults_1 = require("../defaults");
const migrateInitiativeSlugAndOrgUrlKey_1 = require("./migrateInitiativeSlugAndOrgUrlKey");
const migrateInitiativeAddDefaultCatalog_1 = require("./migrateInitiativeAddDefaultCatalog");
/**
 * Apply all necessary migrations to the initiative
 * @param initiative
 * @returns
 */
function applyInitiativeMigrations(initiative) {
    // Ensure the orgUrlKey is lowercase and the slug is updated accordingly
    if (initiative.schemaVersion === defaults_1.HUB_INITIATIVE_CURRENT_SCHEMA_VERSION) {
        return initiative;
    }
    // Apply the migrations
    let migrated = (0, migrateInitiativeAddDefaultCatalog_1.migrateInitiativeAddDefaultCatalog)(initiative);
    migrated = (0, migrateInitiativeSlugAndOrgUrlKey_1.migrateInitiativeSlugAndOrgUrlKey)(migrated);
    migrated = (0, migrateInvalidTimelineStages_1.migrateInvalidTimelineStages)(migrated);
    // add more migration here as needed
    // e.g. migrated = anotherMigration(migrated);
    return migrated;
}
//# sourceMappingURL=applyInitiativeMigrations.js.map