"""Image Input Pipeline schemas (Component F05)."""

from datetime import datetime
from typing import Optional

import numpy as np
from pydantic import BaseModel


class ImageBatch(BaseModel):
    """Batch of raw images for processing."""
    images: list[bytes]
    filenames: list[str]
    start_sequence: int
    end_sequence: int
    batch_number: int


class ImageMetadata(BaseModel):
    """Extracted metadata from an image."""
    sequence: int
    filename: str
    dimensions: tuple[int, int]
    file_size: int
    timestamp: datetime
    exif_data: Optional[dict] = None


class ValidationResult(BaseModel):
    """Result of batch validation."""
    valid: bool
    errors: list[str]


class ProcessingStatus(BaseModel):
    """Status of image pipeline processing."""
    flight_id: str
    total_images: int
    processed_images: int
    current_sequence: int
    queued_batches: int
    processing_rate: float


class ImageData:
    """Loaded image ready for processing."""
    # Using normal class instead of BaseModel for np.ndarray support
    def __init__(
        self,
        flight_id: str,
        sequence: int,
        filename: str,
        image: np.ndarray,
        metadata: ImageMetadata
    ):
        self.flight_id = flight_id
        self.sequence = sequence
        self.filename = filename
        self.image = image
        self.metadata = metadata

class ProcessedBatch:
    """Batch of decoded images."""
    def __init__(self, images: list[ImageData], batch_id: str, start_sequence: int, end_sequence: int):
        self.images = images
        self.batch_id = batch_id
        self.start_sequence = start_sequence
        self.end_sequence = end_sequence
