import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart';
import 'package:diplomaticquarterapp/core/service/contactus/finadus_service.dart';

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

class FindusViewModel extends BaseViewModel {
  FindusService _findusService = locator<FindusService>();

  List<GetHMGLocationsModel> get FindusModelList =>
      _findusService.FindusModelList;

  List<GetHMGLocationsModel> get FindusHospitalModelList=>
  _findusService.FindusHospitalModelList;

  List<GetHMGLocationsModel> get FindusPharmaciesModelList=>
      _findusService.FindusPharmaciesModelList;

  getFindUsRequestOrders() async {
    setState(ViewState.Busy);

    await _findusService.getAllFindUsOrders();

    if (_findusService.hasError) {
      error = _findusService.error;
      setState(ViewState.Error);
    } else
      setState(ViewState.Idle);
  }
}
