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/verify_referral_doctor_remarks.dart';
import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart';
import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart';

class ReferredPatientService extends BaseService {
  List<MyReferredPatientModel> _listMyReferredPatientModel = [];

  List<MyReferredPatientModel> get listMyReferredPatientModel =>
      _listMyReferredPatientModel;

  RequestMyReferralPatientModel _requestMyReferralPatient =
      RequestMyReferralPatientModel();
  VerifyReferralDoctorRemarks _verifyreferraldoctorremarks =
      VerifyReferralDoctorRemarks();

  Future getMyReferredPatient() async {
    await baseAppClient.post(
      GET_MY_REFERRED_PATIENT,
      onSuccess: (dynamic response, int statusCode) {
        _listMyReferredPatientModel.clear();
        response['List_MyReferredPatient'].forEach((v) {
          listMyReferredPatientModel.add(MyReferredPatientModel.fromJson(v));
        });
        // print(response['List_MyReferredPatient']);
      },
      onFailure: (String error, int statusCode) {
        hasError = true;
        super.error = error;
      },
      body: _requestMyReferralPatient.toJson(),
    );
  }

}
