import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/active_medications/ActivePrescriptionReport.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';

class ActiveMedicationsService extends BaseService{

  List<ActivePrescriptionReport> activePrescriptionReport = List();

  getActiveMedication() async {
    hasError = false;
    super.error = "";
    Map<String, dynamic> body = Map();
    body['isDentalAllowedBackend'] = false;
    await baseAppClient.post(ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID,
        onSuccess: (response, statusCode) async {
          activePrescriptionReport.clear();
          response['List_ActiveGetPrescriptionReportByPatientID'].forEach((appoitment) {
            activePrescriptionReport
                .add(ActivePrescriptionReport.fromJson(appoitment));
          });
        }, onFailure: (String error, int statusCode) {
          hasError = true;
          super.error = error;
        }, body: body);
  }

}