import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/active_medications/ActivePrescriptionReport.dart';
import 'package:diplomaticquarterapp/core/service/medical/ActiveMedicationsService.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/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);
    }
  }




}
