import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/vte_assessment/vte_assessment_req_model.dart';
import 'package:doctor_app_flutter/core/model/vte_assessment/vte_assessment_res_model.dart';
import 'package:doctor_app_flutter/core/service/patient/profile/discharge_summary_servive.dart';
import 'package:doctor_app_flutter/core/service/patient/profile/vte_assessment_service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/core/model/discharge_summary/GetDischargeSummaryReqModel.dart';
import 'package:doctor_app_flutter/core/model/discharge_summary/GetDischargeSummaryResModel.dart';

class VteAssessmentViewModel extends BaseViewModel {
  bool hasError = false;
  VteAssessmentService _VteAssessmentService =
      locator<VteAssessmentService>();

  List<VteAssessmentResponseModel> get allVteHistoryList =>
      _VteAssessmentService.allVteHistoryList;

  Future getVteAssessment({
    int? patientId,
    int? admissionNo,
  }) async {
    VteAssessmentRequestModel vteAssessmentRequestModel =
    VteAssessmentRequestModel(
            transactionNo: admissionNo);
    hasError = false;
    setState(ViewState.Busy);
    await _VteAssessmentService.getVteAssessment(
        vteAssessmentRequestModel: vteAssessmentRequestModel);
    if (_VteAssessmentService.hasError) {
      error = _VteAssessmentService.error;
      setState(ViewState.ErrorLocal);
    } else {
      setState(ViewState.Idle);
    }
  }
}
