# Refactor: replace IServiceProvider with IRegionService in RouteProcessingService

**Task**: AZ-360_refactor_replace_iserviceprovider_routeproc
**Name**: Direct IRegionService injection in RouteProcessingService
**Description**: Inject `IRegionService` directly into `RouteProcessingService`; remove the `IServiceProvider` field and the per-iteration scope creation.
**Complexity**: 2 points
**Dependencies**: AZ-364 (C11) — if C11 ships first, the C08 changes happen as part of C11 and this task may close as duplicate.
**Component**: Services.RouteManagement
**Tracker**: AZ-360
**Epic**: AZ-350

## Problem

`SatelliteProvider.Services.RouteManagement/RouteProcessingService.cs:18-22, 105-109, 165-169` injects `IServiceProvider`, then creates a new scope and resolves `IRegionService` inside the loop. `IRegionService` is registered as a singleton (verified in `RegionProcessingServiceCollectionExtensions`), so the scope creation is unnecessary and the service-locator pattern hides the real dependency.

## Outcome

- `RouteProcessingService` declares `IRegionService` in its constructor.
- No `IServiceProvider` field, no per-iteration `using var scope = _serviceProvider.CreateScope();`.
- 37 unit + 5 smoke tests stay green.

## Scope

### Included
- Update constructor parameter list and field.
- Update DI registration in `RouteManagementServiceCollectionExtensions` if the order matters.
- Remove the two `using var scope` blocks; call `_regionService.<method>` directly.

### Excluded
- Changing `IRegionService`'s registration lifetime.
- Other parts of the C11 god-class decomposition.

## Acceptance Criteria

**AC-1: Constructor declares dependency**
Given the post-refactor `RouteProcessingService`
When inspected
Then the constructor parameter list contains `IRegionService` (not `IServiceProvider`).

**AC-2: No scope creation in the loop**
Given the post-refactor source
When grepping for `_serviceProvider.CreateScope()` in `RouteProcessingService.cs`
Then zero matches.

**AC-3: Tests stay green**
Given the post-refactor build
When `scripts/run-tests.sh --smoke` runs
Then all 37 unit + 5 smoke scenarios pass.

## Constraints

- `IRegionService` must remain a singleton for this change to be safe. If a future change makes it scoped, switch to `IServiceScopeFactory`.

## Risks & Mitigation

**Risk 1: C11 lands first and folds this in**
- *Risk*: duplicate work if C11 (AZ-364) ships before C08.
- *Mitigation*: C11 task spec explicitly calls out folding C08; this ticket closes as duplicate when that happens.

Full change entry: `_docs/04_refactoring/03-code-quality-refactoring/list-of-changes.md` (C08).
