import 'package:http/http.dart' as http;
import 'dart:convert';

class BugReportService {
  static const String _apiUrl = 'https://api.supernounou.local/bug-reports';

  static Future<void> sendReport(String description) async {
    try {
      final response = await http.post(
        Uri.parse(_apiUrl),
        headers: {
          'Content-Type': 'application/json',
        },
        body: jsonEncode({
          'description': description,
          'timestamp': DateTime.now().toIso8601String(),
          'platform': 'web', // TODO: Ajouter la détection de la plateforme
        }),
      );

      if (response.statusCode != 200) {
        throw Exception('Erreur lors de l\'envoi du rapport');
      }
    } catch (e) {
      rethrow;
    }
  }
} 