"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.migrateProjectSlugAndOrgUrlKey = migrateProjectSlugAndOrgUrlKey;
const sharedMigrations_1 = require("../../core/_internal/sharedMigrations");
const util_1 = require("../../util");
/**
 * Ensures the orgUrlKey is lowercase and the slug is updated accordingly.
 * Exported just for testing purposes. This is not exported from the main module.
 * @param project
 * @returns
 */
function migrateProjectSlugAndOrgUrlKey(project) {
    if (project.schemaVersion >= 1.1) {
        return project;
    }
    const clone = (0, util_1.cloneObject)(project);
    const { slug, orgUrlKey, typeKeywords } = (0, sharedMigrations_1.migrateSlugAndOrgUrlKey)(clone.slug || "", clone.orgUrlKey || "", clone.typeKeywords || []);
    clone.slug = slug;
    clone.orgUrlKey = orgUrlKey;
    clone.typeKeywords = typeKeywords;
    clone.schemaVersion = 1.1;
    return clone;
}
//# sourceMappingURL=migrateProjectSlugAndOrgUrlKey.js.map