import { identity } from 'es-toolkit';

/**
 * Usage Example:
 *
 * import { generateGroupElements, generateLeafElements } from './nav-selector-entry.mock';
 *
 * const mockNavSelectorEntries = [
 *     // Generate 30 groups with children using default settings
 *     ...generateGroupElements({
 *         count: 30,
 *     }),
 *
 *     // Generate individual leaf elements without groups
 *     ...generateLeafElements({
 *         count: 1,
 *     }),
 * ];
 */
/**
 * Utility function to generate leaf type elements
 * @param options Configuration options for generating leaf elements
 * @returns Array of leaf elements
 */
function generateLeafElements(options, customizer = identity) {
    const { count, uidPrefix = 'account', aliasPrefix = 'Account', startUid = 1, networks = ['facebook', 'instagram', 'youtube', 'tiktok', 'linkedin', 'xPlus'], pictureUrlPattern = 'https://picsum.photos/150/150?random={uid}', disableReasonFrequency = 17, tokenInvalidFrequency = 7, featureLockedFrequency = 11, actions = [], details = [], } = options;
    return Array.from({ length: count }, (_, index) => {
        const uid = startUid + index;
        const networkIndex = index % networks.length;
        const network = networks[networkIndex];
        const finalUid = `${uidPrefix}_${uid}`;
        const finalAlias = `${aliasPrefix} ${uid}`;
        const finalPictureUrl = pictureUrlPattern.replace('{uid}', uid.toString());
        return customizer({
            uid: finalUid,
            counter: null,
            alias: finalAlias,
            pictureUrl: finalPictureUrl,
            disableReason: index > 0 && index % disableReasonFrequency === 0 ? 'The Reports feature is not supported for this account type' : null,
            missingPermission: false,
            network,
            actions,
            details: details.map(detail => {
                return { ...detail, uid: 'detail_' + detail.uid + '_' + finalUid };
            }),
            tokenInvalid: index > 0 && index % tokenInvalidFrequency === 0,
            featureLocked: index > 0 && index % featureLockedFrequency === 0,
            type: 'LEAF',
        }, index);
    });
}
/**
 * Utility function to generate group type elements with children
 * @param options Configuration options for generating group elements
 * @returns Array of group elements
 */
function generateGroupElements(options) {
    const { count, startGroupId = 82529, categories = ['Test Group'], childrenCounts = [10], uidPrefix = 'group', childUidPrefix = 'account', childAliasPrefix = '', startChildUid = 99, childUidIncrement = 30, networks = ['facebook', 'instagram'], pictureUrlPattern = 'https://picsum.photos/150/150?random={uid}', disableReasonFrequency = 999, tokenInvalidFrequency = 999, featureLockedFrequency = 999, actions = [], details = [], } = options;
    // Use a cache to avoid regenerating the same data
    const cacheKey = JSON.stringify(options);
    if (globalThis.__navSelectorMockCache?.[cacheKey]) {
        return globalThis.__navSelectorMockCache[cacheKey];
    }
    const result = Array.from({ length: count }, (_, groupIndex) => {
        const groupId = startGroupId + groupIndex;
        // Reduce default children count to improve performance
        const childrenCount = Math.min(childrenCounts[groupIndex] || 5, 10);
        const startUid = startChildUid + groupIndex * childUidIncrement;
        const groupCategory = categories[groupIndex] || `Category ${groupIndex + 1}`;
        return {
            uid: `${uidPrefix}_${groupId}`,
            alias: groupCategory,
            children: generateLeafElements({
                count: childrenCount,
                uidPrefix: childUidPrefix,
                aliasPrefix: childAliasPrefix || groupCategory,
                startUid: startUid,
                networks,
                pictureUrlPattern,
                disableReasonFrequency,
                tokenInvalidFrequency,
                featureLockedFrequency,
                actions,
                details,
            }),
            folded: true,
            type: 'GROUP',
        };
    });
    // Cache the result
    if (!globalThis.__navSelectorMockCache) {
        globalThis.__navSelectorMockCache = {};
    }
    globalThis.__navSelectorMockCache[cacheKey] = result;
    return result;
}

/**
 * Generated bundle index. Do not edit.
 */

export { generateGroupElements, generateLeafElements };
//# sourceMappingURL=agorapulse-ui-components-nav-selector-testing.mjs.map
