""" View/Event Schema Definitions Projections of domain models for UI consumption via SSE events. These reference existing schema types (e.g., ChunkJobStatus) to maintain type-level dependencies — if the domain model changes, views update too. """ from dataclasses import dataclass from typing import Optional @dataclass class ChunkEvent: """SSE event for a single chunk's lifecycle.""" sequence: int status: str size: Optional[int] = None worker_id: Optional[str] = None processing_time: Optional[float] = None error: Optional[str] = None retries: int = 0 @dataclass class WorkerEvent: """SSE event for worker state changes.""" worker_id: str state: str current_chunk: Optional[int] = None processed: int = 0 errors: int = 0 retries: int = 0 @dataclass class PipelineStats: """Aggregate pipeline statistics, updated via SSE.""" total_chunks: int = 0 processed: int = 0 failed: int = 0 retries: int = 0 elapsed: float = 0.0 throughput_mbps: float = 0.0 queue_size: int = 0 @dataclass class ChunkOutputFile: """A chunk output file in S3/MinIO with presigned download URL.""" key: str size: int = 0 url: str = ""