import 'package:hmg_patient_app/core/enum/viewstate.dart';
import 'package:hmg_patient_app/core/model/active_medications/ActivePrescriptionReport.dart';
import 'package:hmg_patient_app/core/service/medical/ActiveMedicationsService.dart';
import 'package:hmg_patient_app/core/viewModels/base_view_model.dart';
import 'package:hmg_patient_app/locator.dart';

class ActiveMedicationsViewModel extends BaseViewModel {
  ActiveMedicationsService _activeMedicationsService =
      locator<ActiveMedicationsService>();

  List<ActivePrescriptionReport> get activePrescriptionReport =>
      _activeMedicationsService.activePrescriptionReport;

  getActiveMedication() async {
    setState(ViewState.Busy);
    await _activeMedicationsService.getActiveMedication();
    if (_activeMedicationsService.hasError) {
      error = _activeMedicationsService.error!;
      setState(ViewState.Error);
    } else {
      setState(ViewState.Idle);
    }
  }




}
