import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/service/home/scan_qr_service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';

class ScanQrViewModel extends BaseViewModel {
  ScanQrService _scanQrService = locator<ScanQrService>();

  List<PatiantInformtion> get inPatientList => _scanQrService.inPatientList;

  Future getInPatientList(PatientSearchRequestModel requestModel,
      {bool isMyInpatient = false}) async {
    await getDoctorProfile();
    setState(ViewState.Busy);

    await _scanQrService.getInPatient(requestModel, isMyInpatient);
    if (_scanQrService.hasError) {
      error = _scanQrService.error;

      setState(ViewState.ErrorLocal);
    } else {
      setState(ViewState.Idle);
    }
  }
}
