import '../repositories/inspection_history_repository.dart';
import '../models/bo/inspection_history_bo.dart';

class InspectionHistoryService {
  final InspectionHistoryRepository _repository;

  InspectionHistoryService({required InspectionHistoryRepository repository})
      : _repository = repository;

  Future<InspectionHistoryListBO> getList({
    required int pageSize,
    required int pageNum,
    required int deviceId,
  }) async {
    final result = await _repository.getList(
      pageSize: pageSize,
      pageNum: pageNum,
      deviceId: deviceId,
    );
    if (result.success && result.data != null) {
      return result.data!;
    }
    throw Exception(result.msg);
  }
}