import 'package:hmg_patient_app/config/config.dart';
import 'package:hmg_patient_app/config/shared_pref_kay.dart';
import 'package:hmg_patient_app/core/model/contactus/get_patientI_cprojects.dart';

import '../base_service.dart';

class LiveChatService extends BaseService {
  List<GetPatientICProjectsModel> LivechatModelList =[];

  Map<String, dynamic> body = Map();
 // body['body']

  Future getAllLiveChatOrders() async {
    hasError = false;
    body['List_PatientICProjects'] = false;
    body['Latitude'] = await this.sharedPref.getDouble(USER_LAT);
    body['Longitude'] = await this.sharedPref.getDouble(USER_LONG);

    await baseAppClient.post(GET_LIVECHAT_REQUEST,
        onSuccess: (dynamic response, int statusCode) {
      LivechatModelList.clear();

      response['List_PatientICProjects'].forEach((vital) {
        LivechatModelList.add(GetPatientICProjectsModel.fromJson(vital));
      });
    }, onFailure: (String error, int statusCode) {
      hasError = true;
      super.error = error;
    }, body: body);
  }
}
