import 'dart:async';

import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/terms-condition-service.dart';

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

class TermsConditionViewModel extends BaseViewModel {
  TermsConditionService _termsConditionService = locator<TermsConditionService>();

  ListUserAgreement get listUserAgreement => _termsConditionService.listUserAgreement;

  Future getUserTermsAndConditionsForEPharmcy() async {
    setState(ViewState.Busy);
    await _termsConditionService.getUserTermsAndConditionsForEPharmcy();
    if (_termsConditionService.hasError) {
      error = _termsConditionService.error;
      setState(ViewState.Error);
    } else {
      setState(ViewState.Idle);
    }
  }
}
