import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientMuseResultsModel.dart';
import 'package:doctor_app_flutter/core/service/patient/PatientMuseService.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';

import '../../locator.dart';

class PatientMuseViewModel extends BaseViewModel {
  PatientMuseService _patientMuseService = locator<PatientMuseService>();

  List<PatientMuseResultsModel> get patientMuseResultsModelList =>
      _patientMuseService.patientMuseResultsModelList;

  getECGPatient({int? patientType, int? patientOutSA, int? patientID}) async {
    setState(ViewState.Busy);
    await _patientMuseService.getECGPatient(
        patientID: patientID,
        patientOutSA: patientOutSA,
        patientType: patientType);
    if (_patientMuseService.hasError) {
      error = _patientMuseService.error;
      setState(ViewState.Error);
    } else
      setState(ViewState.Idle);
  }
}
