import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';

import '../../../core/enum/reportfilter_type.dart';
import '../../../core/enum/viewstate.dart';
import '../../../core/model/reports/Reports.dart';
import '../../../core/service/medical/reports_service.dart';
import '../../../locator.dart';
import '../base_view_model.dart';

class ReportsMonthlyViewModel extends BaseViewModel {
  ReportFilterType filterType = ReportFilterType.Requested;

  ReportsService _reportsService = locator<ReportsService>();



  String get userAgreementContent => _reportsService.userAgreementContent;

  getUserTermsAndConditions() async{
    setState(ViewState.Busy);
    await _reportsService.getUserTermsAndConditions();
    if (_reportsService.hasError) {
      error = _reportsService.error;
      setState(ViewState.Error);
    } else {
      setState(ViewState.Idle);
    }
  }

  updatePatientHealthSummaryReport({String message, bool isSummary})async{
    setState(ViewState.BusyLocal);
    await _reportsService.updatePatientHealthSummaryReport(isSummary: isSummary);
    if (_reportsService.hasError) {
      error = _reportsService.error;
      AppToast.showErrorToast(message: error);
      setState(ViewState.ErrorLocal);
    } else {
      AppToast.showSuccessToast(message: message);
      setState(ViewState.Idle);
    }
  }



}
