import 'package:fis_jsonrpc/rpc.dart';
import 'package:vitalapp/managers/interfaces/service_pack.dart';
import 'package:vitalapp/rpc.dart';
import 'package:fis_common/logger/logger.dart';
import 'package:vitalapp/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);
      print(result);
      return result;
    } catch (e) {
      logger.e("getServiceItemList query patient paged list error.", e);
      return null;
    }
  }
}
