import React from 'react';
import { Text } from '@wix/design-system';
export function fromMultipleSelectionToBoolean(multipleSelection) {
    if (multipleSelection === undefined) {
        return false;
    }
    if (typeof multipleSelection === 'boolean') {
        return multipleSelection;
    }
    return multipleSelection > 1;
}
function maxSelectedItemsFromMultipleSelection(multipleSelection) {
    if (typeof multipleSelection === 'undefined') {
        return 1;
    }
    if (typeof multipleSelection === 'boolean') {
        return multipleSelection ? Infinity : 1;
    }
    return multipleSelection;
}
export function showMaxSelectionLabel(multipleSelection) {
    const maxSelectedItems = maxSelectedItemsFromMultipleSelection(multipleSelection);
    return !(maxSelectedItems === 1 || maxSelectedItems === Infinity);
}
export function BulkSelectionMaxSelectionLabel(props) {
    const { selectedCount, t, multiple, dataHook } = props;
    const maxSelectedItems = maxSelectedItemsFromMultipleSelection(multiple);
    let text;
    if (props.customLabel) {
        text = props.customLabel({
            num: selectedCount,
            max: maxSelectedItems,
        });
    }
    else if (selectedCount === 0) {
        text = t('cairo.bulkSelected.selectUpTo', {
            max: maxSelectedItems,
        });
    }
    else if (maxSelectedItems > selectedCount) {
        text = t('cairo.picker.itemsSelected', {
            total: selectedCount,
            max: maxSelectedItems,
        });
    }
    else {
        text = t('cairo.bulkSelected.withMaxNumber', {
            num: selectedCount,
            max: maxSelectedItems,
        });
    }
    return (React.createElement(Text, { dataHook: dataHook, secondary: true }, text));
}
export function reachedMaxSelection({ collection, multiple, }) {
    if (typeof multiple === 'undefined' ||
        typeof multiple === 'boolean' ||
        multiple <= 1) {
        return false;
    }
    return collection.bulkSelect.selectedCount >= multiple;
}
//# sourceMappingURL=MaxSelection.js.map