# Module: DataAccess/Repositories/RegionRepository

## Purpose
Dapper-based repository for the `regions` table. Tracks region processing requests and their status lifecycle.

## Public Interface

### IRegionRepository (interface)
- `GetByIdAsync(Guid id) → Task<RegionEntity?>`
- `GetByStatusAsync(string status) → Task<IEnumerable<RegionEntity>>`: retrieves all regions with a given status, ordered by creation date ASC
- `InsertAsync(RegionEntity region) → Task<Guid>`
- `UpdateAsync(RegionEntity region) → Task<int>`
- `DeleteAsync(Guid id) → Task<int>`

### RegionRepository (implementation)
Same connection-per-call pattern as TileRepository.

## Internal Logic
Standard CRUD. `GetByStatusAsync` orders by `created_at ASC` to process oldest requests first.

## Dependencies
- NuGet: `Dapper`, `Npgsql`
- `SatelliteProvider.DataAccess.Models.RegionEntity`
- `Microsoft.Extensions.Logging`

## Consumers
- `RegionService` — insert on request, update during processing
- `RouteProcessingService` — reads region records to check status and get CSV paths

## Data Models
Operates on `RegionEntity`.

## Configuration
Connection string via constructor.

## External Integrations
PostgreSQL.

## Security
None.

## Tests
No dedicated tests.
