import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart';
import '../base_service.dart';

class ErService extends BaseService {
  List<ProjectAvgERWaitingTime> projectAvgERWaitingTimeModelList = List();

  Map<String, dynamic> body = Map();

  Future getProjectAvgERWaitingTimeOrders({int id, int projectID}) async {
    hasError = false;

    if (id != null && projectID != null) {
      body['ID'] = id;
      body['ProjectID'] = projectID;
    }
    var lat = await sharedPref.getDouble(USER_LAT);
    var long = await sharedPref.getDouble(USER_LONG);
    body['Latitude'] = lat ?? 0;
    body['Longitude'] = long ?? 0;

    dynamic localRes;

    await baseAppClient.post(GET_NEAREST_HOSPITAL,
        onSuccess: (dynamic response, int statusCode) {
          localRes = response;
    }, onFailure: (String error, int statusCode) {
      hasError = true;
      super.error = error;
    }, body: body);
    return Future.value(localRes);
  }
}
