import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCartItemsResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/tamara_payment_option.dart';
import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';

class OfferCategoriesViewModel extends BaseViewModel{
  OffersAndPackagesServices service = locator<OffersAndPackagesServices>();
  get categoryList => service.categoryList;
  get productList => service.categoryList;

}

class PackagesViewModel extends BaseViewModel {
  OffersAndPackagesServices service = locator<OffersAndPackagesServices>();

  List<PackagesCategoriesResponseModel> get categoryList => service.categoryList;
  List<PackagesResponseModel> get productList => service.productList;
  List<PackagesResponseModel> get latestOffersList => service.latestOffersList;
  List<PackagesResponseModel> get bestSellerList => service.bestSellerList;
  List<PackagesResponseModel> get bannersList => service.bannersList;
  List<PackagesCartItemsResponseModel> get cartItemList => service.cartItemList;
  List<HospitalsModel> get hospitals => service.hospitals;

  List<TamaraPaymentOption> get tamara_options => service.tamaraPaymentOptions;
  bool allowTamara = true;

  setTamaraIllegablity(double amount){
    bool illegible = true;
    if(tamara_options == null || tamara_options.isEmpty)
      illegible =  false;
    else{
      tamara_options.forEach((element) {
        final ill = (amount >= element.minLimit && amount <= element.maxLimit);
        element.enable = ill;
        illegible = illegible || ill;
      });
    }
    allowTamara =  illegible;
  }

  String _cartItemCount = "";

  String get cartItemCount => _cartItemCount;

  set cartItemCount(String value) {
    _cartItemCount = value;
    notifyListeners();
  }
}
