/**
 * Progress tracking utilities for bulk operations
 */

export interface ProgressUpdate {
  type: 'progress' | 'completed' | 'error';
  current: number;
  total: number;
  message: string;
  url?: string;
  title?: string;
  author?: string;
  wordCount?: number;
  totalWordCount?: number;
  error?: string;
  combinedStory?: any;
  results?: any[];
  summary?: any;
  hasImages?: boolean;
  imageWarnings?: string[];
}

// Global progress storage (in production, use Redis or database)
export const progressStore = new Map<string, ProgressUpdate[]>();

// Helper function for other routes to send progress updates
export function sendProgressUpdate(sessionId: string, update: ProgressUpdate) {
  if (!progressStore.has(sessionId)) {
    progressStore.set(sessionId, []);
  }
  progressStore.get(sessionId)!.push(update);
}