/**
 * Preload Configuration
 *
 * Centralized configuration for asset preloading, priority weights, and queue settings.
 */

export const PRELOAD_CONFIG = {
  // Queue settings
  maxConcurrentDownloads: 3,
  maxRetries: 3,
  retryDelayMs: 1000,

  // Size thresholds
  largeFileThreshold: 5 * 1024 * 1024, // 5MB -> use IndexedDB
  videoChunkSize: 5 * 1024 * 1024, // 5MB chunks
  initialVideoBufferSeconds: 5,

  // Priority weights (higher = load first)
  priority: {
    currentPage: 1000,
    neighborBase: 500,
    assetType: {
      image: 100,
      transition: 80,
      audio: 50,
      video: 30,
    } as Record<string, number>,
    variant: {
      thumbnail: 50,
      preview: 40,
      webp: 35,
      mp4_low: 20,
      mp4_high: 10,
      original: 5,
    } as Record<string, number>,
    linkCountMultiplier: 10,
    maxLinkBonus: 50,
  },

  // Storage
  storage: {
    warningPercent: 80,
    criticalPercent: 95,
    minFreeBuffer: 50 * 1024 * 1024, // 50MB
  },

  // Auto-cleanup timeouts (from hoboken pattern)
  autoRemove: {
    completedMs: 3000,
    errorMs: 10000,
  },

  // Neighbor graph traversal
  neighborGraph: {
    maxDepth: 2, // How far to look ahead
    constructorMaxDepth: 1, // Reduced depth for constructor preview
  },
} as const;

export type PreloadConfig = typeof PRELOAD_CONFIG;
