import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/models/pharmacy/reviewModel.dart';
import 'package:diplomaticquarterapp/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);
  }
}