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

class ActiveMedicationsService extends BaseService{

  List<ActivePrescriptionReport> activePrescriptionReport =[];

  getActiveMedication() async {
    hasError = false;
    super.error = "";
    Map<String, dynamic> body = Map();
    // body['isDentalAllowedBackend'] = false;
    // body['PatientID'] = 1298851;
    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);
  }

}