import type { DownloadStatus } from '../bindings/DownloadStatus'; const STARTABLE_STATUSES: ReadonlySet = new Set([ 'ready', 'paused', 'failed', ]); const PAUSABLE_STATUSES: ReadonlySet = new Set([ 'queued', 'downloading', 'processing', 'retrying', ]); const REDOWNLOADABLE_STATUSES: ReadonlySet = new Set([ 'completed', 'failed', 'paused', ]); export const canStartDownload = (status: DownloadStatus): boolean => STARTABLE_STATUSES.has(status); export const canPauseDownload = (status: DownloadStatus): boolean => PAUSABLE_STATUSES.has(status); export const canRedownload = (status: DownloadStatus): boolean => REDOWNLOADABLE_STATUSES.has(status); export const startActionLabel = (status: DownloadStatus): 'Start' | 'Resume' => status === 'ready' || status === 'failed' ? 'Start' : 'Resume'; export const isTransferLocked = (status: DownloadStatus): boolean => status === 'downloading' || status === 'processing' || status === 'retrying'; export const isIdentityLocked = (status: DownloadStatus): boolean => isTransferLocked(status) || status === 'completed';