import 'package:fis_jsonrpc/rpc.dart';
import 'package:vnoteapp/managers/interfaces/service_pack.dart';
import 'package:vnoteapp/rpc.dart';
import 'package:fis_common/logger/logger.dart';
import 'package:vnoteapp/store/store.dart';

class ServicePackManager implements IServicePackManager {
  @override
  Future<PageCollection<ServicePackDTO>?> getServicePackList(
      ServicePackPageRequest request) async {
    try {
      request.token = Store.user.token;
      final result = await rpc.servicePack.getServicePackPageAsync(request);
      return result;
    } catch (e) {
      logger.e("getServicePackPageAsync query patient paged list error.", e);
      return null;
    }
  }

  @override
  Future<PageCollection<ServiceItemDTO>?> getServiceItemList(
      PageRequest request) async {
    try {
      request.token = Store.user.token;
      final result = await rpc.servicePack.getServiceItemPageAsync(request);
      return result;
    } catch (e) {
      logger.e("PatientManager query patient paged list error.", e);
      return null;
    }
  }
}
