import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/models/Request.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';

class ClinicListService extends BaseService {
  AppSharedPreferences sharedPref = AppSharedPreferences();
  AppGlobal appGlobal = new AppGlobal();

  Future<Map> getClinicsList(context) async {
    Map<String, dynamic> request;
    var languageID = await sharedPref.getString(APP_LANGUAGE);
    Request req = appGlobal.getPublicRequest();
    request = {
      "LanguageID": languageID == 'ar' ? 1 : 2,
      "IPAdress": "10.20.10.20",
      "VersionID": req.VersionID,
      "Channel": req.Channel,
      "generalid": 'Cs2020@2016\$2958',
      "PatientOutSA": 0,
      "TokenID": "",
      "DeviceTypeID": req.DeviceTypeID,
      "SessionID": null
    };

    dynamic localRes;

    await baseAppClient.post(GET_CLINICS_LIST_URL,
        onSuccess: (response, statusCode) async {
          localRes = response;
        }, onFailure: (String error, int statusCode) {
          throw error;
        }, body: request);
    return Future.value(localRes);
  }
}
