import '../../network_api_service/api_service/api_service.dart';
import '../../network_api_service/api_urls/api_urls.dart';
import '../models/recent_scan_history_model.dart';

class RecentScanHistoryRepository {
  final ApiService _apiService = ApiService();

  Future<List<RecentScanHistory>> fetchRecentScanHistory() async {
    try {
      final response = await _apiService.get(ApiUrls.scanHistory);
      final RecentScanHistoryResponse scanResponse =
          RecentScanHistoryResponse.fromJson(response.data);
      return scanResponse.data;
    } catch (e) {
      throw Exception('Failed to fetch recent scan history: $e');
    }
  }
}
