import { isPreview as PREVIEW } from '../isPreview'
import { newId } from '../lib/id'
import { type DownloadItem } from './downloadTypes'

// Mock seed data so every visual state is visible in the UI preview. Empty in a
// real run -- the queue starts blank. Gated on `import.meta.env.DEV` as well as the
// runtime PREVIEW flag so Rollup dead-code-eliminates this whole array from the
// packaged (production) renderer build, where DEV is statically false (L128).
export const seed: DownloadItem[] =
  import.meta.env.DEV && PREVIEW
    ? [
        {
          id: newId('item'),
          url: 'https://youtube.com/watch?v=dQw4w9WgXcQ',
          title: 'Building a Desktop App with Electron -- Full Course',
          channel: 'DevChannel',
          durationLabel: '1:42:08',
          kind: 'video',
          quality: '1080p',
          status: 'downloading',
          progress: 0.42,
          speedBytesPerSec: 4.7 * 1024 * 1024,
          etaSeconds: 72,
          sizeLabel: '512 MB'
        },
        {
          id: newId('item'),
          url: 'https://youtube.com/watch?v=abcd1234',
          title: 'Lo-fi beats to code to (1 hour mix)',
          channel: 'ChillStudio',
          durationLabel: '1:00:21',
          kind: 'audio',
          quality: 'Best',
          status: 'queued',
          progress: 0
        },
        {
          id: newId('item'),
          url: 'https://youtube.com/watch?v=zzz9999',
          title: 'How yt-dlp Works Under the Hood',
          channel: 'Open Source Weekly',
          durationLabel: '14:03',
          kind: 'video',
          quality: '720p',
          status: 'completed',
          progress: 1,
          sizeLabel: '184 MB',
          filePath: 'C:\\Users\\you\\Downloads\\How yt-dlp Works Under the Hood.mp4'
        },
        {
          id: newId('item'),
          url: 'https://youtube.com/watch?v=err0r',
          title: 'Private video',
          channel: undefined,
          kind: 'video',
          quality: 'Best available',
          status: 'error',
          progress: 0,
          error: 'Video unavailable: this video is private.'
        }
      ]
    : []
