import { FILE_MAX_SIZE_ERROR_INFO } from './constants';
export const restrictFileMaxSize = (formatSizeToView, maxSize) => (file) => {
    if (!file.size || !maxSize) {
        return undefined;
    }
    if (file.size > maxSize) {
        const maxSizeToView = formatSizeToView?.(maxSize);
        return {
            code: FILE_MAX_SIZE_ERROR_INFO.code,
            message: FILE_MAX_SIZE_ERROR_INFO.message(maxSizeToView),
        };
    }
    return undefined;
};
