import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/schedule_service.dart';
import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table_model.dart';

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

class ScheduleViewModel extends BaseViewModel {
  ScheduleService _scheduleService = locator<ScheduleService>();

  List<ListDoctorWorkingHoursTable> get listDoctorWorkingHoursTable => _scheduleService.listDoctorWorkingHoursTable;

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