import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/wishList_service.dart';

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

class  WishListViewModel extends BaseViewModel{
  WishListService _wishlistService = locator<WishListService>();

  List<Wishlist> get wishListList => _wishlistService.wishListProducts;
  bool hasError = false;


  Future getWishlistData({isLocalLoader = false}) async {
    hasError = false;
    setState(isLocalLoader ? ViewState.BusyLocal:ViewState.Busy);
    await _wishlistService.getWishlist();
    if (_wishlistService.hasError) {
      error = _wishlistService.error;
      setState(ViewState.ErrorLocal);
    } else
      setState(ViewState.Idle);
  }
}