import '../models/bo/device_list_bo.dart';
import '../repositories/device_list_repository.dart';

class DeviceListService {
  final DeviceListRepository _repository;

  DeviceListService({required DeviceListRepository repository})
      : _repository = repository;

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