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();
  }

  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);
      }
    }
  }
}
