import 'package:hmg_patient_app/core/enum/viewstate.dart';
import 'package:hmg_patient_app/core/viewModels/base_view_model.dart';
import 'package:hmg_patient_app/models/pharmacy/reviewModel.dart';
import 'package:hmg_patient_app/services/pharmacy_services/review_service.dart';

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

class ReviewViewModel extends BaseViewModel{
  ReviewService _reviewService = locator<ReviewService>();

  List<Review> get reviewListList => _reviewService.reviewList;

  bool hasError = false;


  Future getReviewData() async {
    hasError = false;
    setState(ViewState.Busy);
    await _reviewService.getReview();
    if (_reviewService.hasError) {
      error = _reviewService.error!;
      setState(ViewState.ErrorLocal);
    } else
      setState(ViewState.Idle);
  }
}