# Feature: Processing Delegation

## Description
Delegation methods that route API calls from F01 Flight API to appropriate subsystems. Manages F02.2 Processing Engine instances, coordinates image queuing, handles user fixes, and provides access to SSE streaming and coordinate transformation services.

## Component APIs Implemented
- `queue_images(flight_id: str, batch: ImageBatch) -> BatchQueueResult` - Queues images via F05, ensures F02.2 engine is active
- `handle_user_fix(flight_id: str, fix_data: UserFixRequest) -> UserFixResult` - Forwards user fix to active F02.2 engine
- `create_client_stream(flight_id: str, client_id: str) -> StreamConnection` - Creates SSE stream via F15
- `convert_object_to_gps(flight_id: str, frame_id: int, pixel: Tuple[float, float]) -> GPSPoint` - Converts pixel to GPS via F13

## External Dependencies
- **F02.2 Flight Processing Engine** - Managed child component, created/retrieved per flight
- **F05 Image Input Pipeline** - Image batch queuing
- **F13 Coordinate Transformer** - Pixel-to-GPS conversion
- **F15 SSE Event Streamer** - Client stream creation

## Internal Methods

### Engine Management
- `_get_or_create_engine(flight_id: str) -> FlightProcessingEngine` - Retrieves existing or creates new F02.2 instance
- `_get_active_engine(flight_id: str) -> Optional[FlightProcessingEngine]` - Gets active engine or None
- `_engine_registry: Dict[str, FlightProcessingEngine]` - Registry of active engines per flight

### Image Queuing
- `_delegate_queue_batch(flight_id: str, batch: ImageBatch)` - Delegates to F05.queue_batch
- `_trigger_processing(engine: FlightProcessingEngine)` - Triggers async engine.start_processing

### User Fix Handling
- `_validate_fix_request(fix_data: UserFixRequest)` - Validates fix data before delegation
- `_apply_fix_to_engine(engine: FlightProcessingEngine, fix_data: UserFixRequest)` - Calls engine.apply_user_fix

### Stream Management
- `_delegate_stream_creation(flight_id: str, client_id: str)` - Delegates to F15

### Coordinate Conversion
- `_delegate_coordinate_transform(flight_id: str, frame_id: int, pixel: Tuple)` - Delegates to F13

## Unit Tests
- Test queue_images delegates to F05.queue_batch
- Test queue_images creates new engine if none exists
- Test queue_images retrieves existing engine for active flight
- Test queue_images triggers engine.start_processing
- Test handle_user_fix returns error for non-existent flight
- Test handle_user_fix delegates to correct engine
- Test create_client_stream delegates to F15
- Test convert_object_to_gps delegates to F13
- Test engine registry tracks active engines correctly
- Test multiple queue_images calls reuse same engine instance

## Integration Tests
- Test queue_images end-to-end with F05 and F02.2
- Test image batch flows through F05 to F02.2 processing
- Test user fix applied correctly through F02.2
- Test SSE stream creation and connection via F15
- Test coordinate conversion accuracy via F13
- Test engine cleanup on flight completion
- Test concurrent requests to same flight share engine

