import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';

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

class DashboardViewModel extends BaseViewModel {
  VitalSignService _vitalSignService = locator<VitalSignService>();

  String get weightKg => _vitalSignService.weightKg;

  String get heightCm => _vitalSignService.heightCm;
  String booldType = "-";
  DashboardViewModel() {
    this.getPatientRadOrders();
  }
  // ToDoCountProviderModel toDoProvider =
  //     Provider.of<ToDoCountProviderModel>(AppGlobal.context);

  getPatientRadOrders() async {
    if (isLogin && _vitalSignService.weightKg.isEmpty) {
      setState(ViewState.Busy);
      await _vitalSignService.getPatientRadOrders();
      if (_vitalSignService.hasError) {
        error = _vitalSignService.error;
        setState(ViewState.ErrorLocal);
      } else {
        booldType = await sharedPref.getString(BLOOD_TYPE) ?? "-";
        setState(ViewState.Idle);
      }
    }
  }

// getToDoCount() {
//   toDoProvider.setState(0);
//   ClinicListService service = new ClinicListService();
//   service.getActiveAppointmentNo(AppGlobal.context).then((res) {
//     print(res['AppointmentActiveNumber']);
//     if (res['MessageStatus'] == 1) {
//       toDoProvider.setState(res['AppointmentActiveNumber']);
//     } else {}
//   }).catchError((err) {
//     print(err);
//   });
// }
}
