"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProfileMigrations = void 0;
class ProfileMigrations {
    /**
     * Get all migrations
     * **NOTE: CURRENT_PROFILE_VERSION variable should be updated** in Profile model
     * when adding a new migration
     * @static
     * @returns {Record<string, (profiles: ProfileRecord) => ProfileRecord>}
     */
    static get() {
        return {
            2: ProfileMigrations.version2_networkCurrency,
            3: ProfileMigrations.version3_profileType,
        };
    }
    /**
     * Adds a version property
     * Adds a networkCurrency property
     * @static
     * @param {ProfileRecord} profiles
     * @returns {ProfileRecord}
     */
    static version2_networkCurrency(profiles) {
        return Object.entries(profiles)
            .map(([name, profile]) => ({
            [name]: {
                ...profile,
                version: 2,
                networkCurrency: {
                    namespaceId: 'symbol.xym',
                    divisibility: 6,
                },
            },
        }))
            .reduce((acc, profile) => ({ ...acc, ...profile }), {});
    }
    /**
     * Adds a profile type property
     * @static
     * @param {ProfileRecord} profiles
     * @returns {ProfileRecord}
     */
    static version3_profileType(profiles) {
        return Object.entries(profiles)
            .map(([name, profile]) => ({
            [name]: {
                ...profile,
                version: 3,
                type: 'PrivateKey',
            },
        }))
            .reduce((acc, profile) => ({ ...acc, ...profile }), {});
    }
}
exports.ProfileMigrations = ProfileMigrations;
