import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckActivationCodeModel.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/GetPatientInfoRequestModel.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/GetPatientInfoResponseModel.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; class PatientRegistrationService extends BaseService { GetPatientInfoResponseModel getPatientInfoResponseModel; checkPatientForRegistration( CheckPatientForRegistrationModel registrationModel) async { hasError = false; await baseAppClient.post(CHECK_PATIENT_FOR_REGISTRATION, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: registrationModel.toJson()); } getPatientInfo(GetPatientInfoRequestModel getPatientInfoRequestMode) async { hasError = false; await baseAppClient.post(GET_PATIENT_INFO, onSuccess: (dynamic response, int statusCode) { getPatientInfoResponseModel = GetPatientInfoResponseModel.fromJson(response); print("ddd"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: getPatientInfoRequestMode.toJson()); } sendActivationCodeByOTPNotificationType( {SendActivationCodeByOTPNotificationTypeForRegistrationModel registrationModel, int otpType, PatientRegistrationViewModel user, CheckPatientForRegistrationModel checkPatientForRegistrationModel}) async { registrationModel = SendActivationCodeByOTPNotificationTypeForRegistrationModel( oTPSendType: otpType, patientIdentificationID: checkPatientForRegistrationModel.patientIdentificationID, patientMobileNumber: checkPatientForRegistrationModel.patientMobileNumber, zipCode: checkPatientForRegistrationModel.zipCode, patientOutSA: false, healthId: "30000018540264", dOB: checkPatientForRegistrationModel.dOB, isRegister: checkPatientForRegistrationModel.isRegister, isHijri: checkPatientForRegistrationModel.isHijri, ); hasError = false; await baseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOT_TYPE, onSuccess: (dynamic response, int statusCode) { registrationModel = SendActivationCodeByOTPNotificationTypeForRegistrationModel.fromJson( response); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: registrationModel.toJson()); } checkActivationCode(CheckActivationCodeModel registrationModel) async { hasError = false; await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_PATIENT, onSuccess: (dynamic response, int statusCode) { registrationModel = CheckActivationCodeModel.fromJson(response); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: registrationModel.toJson()); } registrationPatient(PatientRegistrationModel registrationModel) async { hasError = false; await baseAppClient.post(PATIENT_REGISTRATION, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: registrationModel.toJson()); } }