import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';

class MedicalService extends BaseService {
  List<AppoitmentAllHistoryResultList> appoitmentAllHistoryResultList = List();

  getAppointmentHistory() async {
    hasError = false;
    super.error = "";

    await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY,
        onSuccess: (response, statusCode) async {
      appoitmentAllHistoryResultList.clear();
      response['AppoimentAllHistoryResultList'].forEach((appoitment) {
        appoitmentAllHistoryResultList
            .add(AppoitmentAllHistoryResultList.fromJson(appoitment));
      });
    }, onFailure: (String error, int statusCode) {
      hasError = true;
      super.error = error;
    }, body: Map());
  }
}
