import 'package:hmg_patient_app/config/config.dart';
import 'package:hmg_patient_app/config/shared_pref_kay.dart';
import 'package:hmg_patient_app/core/service/base_service.dart';
import 'package:hmg_patient_app/models/Authentication/authenticated_user.dart';
import 'package:hmg_patient_app/models/pharmacy/reviewModel.dart';
import 'package:hmg_patient_app/services/authentication/auth_provider.dart';
import 'package:hmg_patient_app/uitl/app_shared_preferences.dart';


class ReviewService extends BaseService {
  AppSharedPreferences sharedPref = AppSharedPreferences();

  AuthenticatedUser authUser = new AuthenticatedUser();
  AuthProvider authProvider = new AuthProvider();

  bool isLogin = false;
  List<Review> _reviewList =[];
  List<Review> get reviewList => _reviewList;


  Future getReview() async {

    var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);

    hasError = false;
    await baseAppClient.getPharmacy(GET_REVIEW+customerId,
        onSuccess: (dynamic response, int statusCode) {
          _reviewList.clear();
          response['reviews'].forEach((item) {
            _reviewList.add(Review.fromJson(item));
          });
        }, onFailure: (String error, int statusCode) {
          hasError = true;
          super.error = error;
        });
  }

}
