import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table_model.dart';
import 'package:doctor_app_flutter/models/doctor/request_schedule.dart';

class ScheduleService extends BaseService {

  List<ListDoctorWorkingHoursTable> get listDoctorWorkingHoursTable => _listDoctorWorkingHoursTable;
  List<ListDoctorWorkingHoursTable> _listDoctorWorkingHoursTable = [];


  RequestSchedule _requestSchedule = RequestSchedule();
  Future getDoctorSchedule() async {
    await baseAppClient.post(GET_DOCTOR_WORKING_HOURS_TABLE,
        onSuccess: (dynamic response, int statusCode) {
          _listDoctorWorkingHoursTable.clear();
      response['List_DoctorWorkingHoursTable'].forEach((v) {
        _listDoctorWorkingHoursTable
            .add(ListDoctorWorkingHoursTable.fromJson(v));
      });
    }, onFailure: (String error, int statusCode) {
      hasError = true;
      super.error = error;
    }, body: _requestSchedule.toJson(),);
  }
}
