import 'package:shared_preferences/shared_preferences.dart';
import '../../../Helper/Constants/Apiconstants.dart';
import '../../../Model/Response/Tenantlocation/Getlocationbyidresponse.dart';
import '../../../Model/Response/Tenantlocation/Locationbyid/Locationidresponse.dart';
import '../../Provider/Tenantlocation/Getlocationprovider.dart';


class GetLocationsRepository{
  GetLocationsProvider getLocationsProvider = GetLocationsProvider();
  int? tenantId;
  int? locationId;

  Future<GetLocationByTenantId?> getTenantLocationById() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    tenantId = prefs.getInt('tenantId')??0;
    locationId = prefs.getInt('locationId')??0;
    var result = await getLocationsProvider.getTenantLocationById('${ApiConstants.getTenantLocationById}?tenantid=$tenantId&locationid=$locationId');
    return result;
  }

  Future<GetLocationByLocaionId?> getLocationById() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    tenantId = prefs.getInt('tenantId')??0;
    locationId = prefs.getInt('locationId')??0;
    var result = await getLocationsProvider.getLocationById('${ApiConstants.getLocationsById}?tenantid=$tenantId&locationid=$locationId',);
    return result;
  }

}
