import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/dasboard_service.dart';
import 'package:doctor_app_flutter/core/service/medicine_service.dart';

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

class DashboardViewModel extends BaseViewModel {
  DashboardService _dashboardService = locator<DashboardService>();
  get dashboardItemsList => _dashboardService.dashboardItemsList;

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