import 'package:laki_icu_app/models/bo/monitoring_bo.dart';
import 'package:laki_icu_app/repositories/monitoring_repository.dart';

class MonitoringService {
  final MonitoringRepository _repository;

  MonitoringService() : _repository = MonitoringRepository.instance;

  Future<List<MonitoringMetricBO>> getMetrics() async {
    final result = await _repository.getMetrics();
    if (result.success && result.data != null) {
      return result.data!;
    }
    throw Exception(result.msg);
  }

  Future<PatientInfoBO> getPatientInfo() async {
    final result = await _repository.getPatientInfo();
    if (result.success && result.data != null) {
      return result.data!;
    }
    throw Exception(result.msg);
  }

  Future<List<AlertInfoBO>> getAlerts() async {
    final result = await _repository.getAlerts();
    if (result.success && result.data != null) {
      return result.data!;
    }
    throw Exception(result.msg);
  }

  Future<List<MonitoringMenuItemBO>> getMenuItems() async {
    final result = await _repository.getMenuItems();
    if (result.success && result.data != null) {
      return result.data!;
    }
    throw Exception(result.msg);
  }
}
