createPopoReport method

Future<String> createPopoReport(
  1. String userId,
  2. RaliPosition position, {
  3. required String detectionType,
  4. String? radarType,
  5. int? direction,
  6. int? lane,
})

Creates a "popo" (police) report

Implementation

Future<String> createPopoReport(
  String userId,
  RaliPosition position, {
  required String detectionType, // visual, radar, laser, etc.
  String? radarType,
  int? direction,
  int? lane,
}) async {
  try {
    // Create the details map based on detection type
    final details = <String, dynamic>{
      'detectionType': detectionType,
    };

    // Add radar type if applicable
    if (detectionType == 'radar' && radarType != null) {
      details['radarType'] = radarType;
    }

    return await createUserReport(
      userId,
      'popo',
      position,
      details,
      direction: direction,
      lane: lane,
      suggestedAlternative: 'warn', // Default for police reports
    );
  } catch (e) {
    print('Error creating popo report: $e');
    rethrow;
  }
}