96 lines
3.1 KiB
Dart
96 lines
3.1 KiB
Dart
import 'package:flutter/foundation.dart';
|
|
import 'road_alert_models.dart';
|
|
import 'road_alert_provider_interface.dart';
|
|
|
|
class MockRoadAlertProvider implements RoadAlertProvider {
|
|
@override
|
|
String get id => 'mock_police_debug';
|
|
|
|
@override
|
|
String get name => 'Debug Mock Police & Speed-Traps';
|
|
|
|
@override
|
|
Set<RoadAlertCategory> get supportedCategories => const {
|
|
RoadAlertCategory.police,
|
|
RoadAlertCategory.speedCamera,
|
|
RoadAlertCategory.accident,
|
|
RoadAlertCategory.hazard,
|
|
RoadAlertCategory.roadClosure,
|
|
RoadAlertCategory.construction,
|
|
RoadAlertCategory.traffic,
|
|
RoadAlertCategory.other,
|
|
};
|
|
|
|
@override
|
|
Future<RoadAlertProviderStatus> testConnection(String apiKey) async {
|
|
return kDebugMode ? RoadAlertProviderStatus.connected : RoadAlertProviderStatus.notConfigured;
|
|
}
|
|
|
|
@override
|
|
Future<List<RoadAlert>> getAlerts({
|
|
required double latitude,
|
|
required double longitude,
|
|
required double radiusMeters,
|
|
String? apiKey,
|
|
}) async {
|
|
// Safety check: Never return mock alerts in release mode
|
|
if (!kDebugMode) return [];
|
|
|
|
final now = DateTime.now();
|
|
|
|
return [
|
|
RoadAlert(
|
|
id: 'mock_police_1',
|
|
providerId: id,
|
|
category: RoadAlertCategory.police,
|
|
latitude: latitude + 0.0035, // ~380 meters ahead
|
|
longitude: longitude + 0.0012,
|
|
heading: 45.0,
|
|
roadName: 'Highway 101 North / Mile Marker 14',
|
|
description: 'Police reported visible on shoulder (Debug Mock)',
|
|
reportedAt: now.subtract(const Duration(minutes: 4)),
|
|
expiresAt: now.add(const Duration(minutes: 26)),
|
|
lastUpdated: now,
|
|
confidence: 0.88,
|
|
severity: RoadAlertSeverity.high,
|
|
source: 'Community Report (Debug Mock)',
|
|
sourceType: RoadAlertSourceType.userReported,
|
|
),
|
|
RoadAlert(
|
|
id: 'mock_speedcam_1',
|
|
providerId: id,
|
|
category: RoadAlertCategory.speedCamera,
|
|
latitude: latitude + 0.0055, // ~600 meters ahead
|
|
longitude: longitude - 0.0020,
|
|
heading: 90.0,
|
|
roadName: 'Grand Avenue & 5th St',
|
|
description: 'Speed enforcement camera active (Debug Mock)',
|
|
reportedAt: now.subtract(const Duration(minutes: 15)),
|
|
expiresAt: now.add(const Duration(hours: 1)),
|
|
lastUpdated: now,
|
|
confidence: 0.95,
|
|
severity: RoadAlertSeverity.high,
|
|
source: 'Camera Database (Debug Mock)',
|
|
sourceType: RoadAlertSourceType.providerReported,
|
|
),
|
|
RoadAlert(
|
|
id: 'mock_accident_1',
|
|
providerId: id,
|
|
category: RoadAlertCategory.accident,
|
|
latitude: latitude - 0.0040,
|
|
longitude: longitude - 0.0030,
|
|
heading: 180.0,
|
|
roadName: 'Bay Bridge Connector',
|
|
description: 'Two-car collision right lane (Debug Mock)',
|
|
reportedAt: now.subtract(const Duration(minutes: 8)),
|
|
expiresAt: now.add(const Duration(minutes: 40)),
|
|
lastUpdated: now,
|
|
confidence: 0.92,
|
|
severity: RoadAlertSeverity.critical,
|
|
source: 'Community Report (Debug Mock)',
|
|
sourceType: RoadAlertSourceType.userReported,
|
|
),
|
|
];
|
|
}
|
|
}
|