using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Services.CopriApi;
using TINK.MultilingualResources;
using TINK.Repository;
using TINK.Repository.Request;
using TINK.Repository.Response;
using TINK.Repository.Response.Stations;
using static TINK.Repository.CopriCallsMemory;
namespace TestFramework.Repository
{
/// Allows use of memory for retrieving defined responses.
public class CopriCallsCacheMemory : ICopriCache
{
private CopriCallsMemory server;
public CopriCallsCacheMemory(
string merchantId,
SampleSets? sampleSet = null,
int? index = null,
string sessionCookie = null)
{
server = new CopriCallsMemory(merchantId, sampleSet, index, sessionCookie);
}
public bool IsStationsExpired => true;
public bool IsBikesAvailableExpired => true;
public bool IsBikesOccupiedExpired => true;
public bool IsConnected => server.IsConnected;
public string SessionCookie => server.SessionCookie;
public string MerchantId => server.MerchantId;
public void AddToCache(StationsAvailableResponse stations)
{
return;
}
/// Adds a bikes response to cache.
/// Bikes to add.
/// Uri of the operator host to get bikes from or null if bikes have to be gotten form primary host.
/// Id of station which was used for filtering bikes. Null if no filtering was applied.
/// Id of bike which was used for filtering bikes. Null if no filtering was applied.
public void AddToCache(BikesAvailableResponse bikes, Uri operatorUri = null, string stationId = null, string bikeId = null)
{
return;
}
public void AddToCache(BikesReservedOccupiedResponse bikes)
{
return;
}
public Task DoAuthorizationAsync(string p_strMailAddress, string p_strPassword, string p_strDeviceId)
{
throw new NotImplementedException();
}
public Task DoAuthoutAsync()
{
throw new NotImplementedException();
}
public Task DoReserveAsync(string bikeId, Uri operatorUri)
{
throw new NotImplementedException();
}
public Task DoCancelReservationAsync(string p_iBikeId, Uri operatorUri)
{
throw new NotImplementedException();
}
public Task CalculateAuthKeysAsync(string bikeId, Uri operatorUri)
=> throw new NotSupportedException();
public Task StartReturningBike(
string bikeId,
Uri operatorUri)
=> throw new NotImplementedException();
public Task UpdateLockingStateAsync(
string bikeId,
lock_state state,
Uri operatorUri,
LocationDto geolocation,
double batteryPercentage,
IVersionInfo versionInfo)
=> throw new NotImplementedException();
public Task DoBookAsync(Uri operatorUri, string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
=> throw new NotImplementedException();
public Task BookAvailableAndStartOpeningAsync(string bikeId, Uri operatorUri)
=> throw new NotImplementedException();
public Task BookReservedAndStartOpeningAsync(string bikeId, Uri operatorUri)
=> throw new NotImplementedException();
public Task DoReturn(string bikeId, LocationDto location, Uri operatorUri)
=> throw new NotImplementedException();
/// Returns a bike and starts closing.
/// Id of the bike to return.
/// Provides info about hard and software.
/// Holds the uri of the operator or null, in case of single operator setup.
/// Response on returning request.
public Task ReturnAndStartClosingAsync(
string bikeId,
Uri operatorUri)
=> throw new System.Exception(AppResources.ErrorNoWeb);
public Task DoSubmitFeedback(string bikeId, int? currentChargeBars, string message, bool isBikeBroken, Uri operatorUri)
=> throw new NotImplementedException();
/// Submits mini survey to copri server.
/// Collection of answers.
public Task DoSubmitMiniSurvey(IDictionary answers)
=> throw new NotImplementedException();
/// Gets a list of bikes from Copri.
/// Uri of the operator host to get bikes from or null if bikes have to be gotten form primary host.
/// Id of station which is used for filtering bikes. Null if no filtering should be applied.
/// Id of bike which is used for filtering bikes. Null if no filtering should be applied.
/// Response holding list of bikes.
public Task GetBikesAvailableAsync(Uri operatorUri = null, string stationId = null, string bikeId = null)
=> server.GetBikesAvailableAsync(operatorUri, stationId, bikeId);
public Task GetBikesOccupiedAsync()
{
return server.GetBikesOccupiedAsync();
}
public Task GetStationsAsync()
{
return server.GetStationsAsync();
}
}
}