using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Repository.Request;
using TINK.Repository.Response;
namespace TINK.Repository
{
/// Interface to communicate with copri server.
public interface ICopriServerBase
{
/// Logs user in.
/// Mailaddress of user to log in.
/// Password to log in.
/// Id specifying user and hardware.
/// Response which holds auth cookie
Task DoAuthorizationAsync(
string mailAddress,
string password,
string deviceId);
/// Logs user out.
/// Response which holds auth cookie
Task DoAuthoutAsync();
/// Reserves bike.
/// Id of the bike to reserve.
/// Holds the uri of the operator or null, in case of single operator setup.
/// Response on reserving request.
Task DoReserveAsync(
string bikeId,
Uri operatorUri);
/// Cancels reservation of bik.
/// Id of the bike to reserve.
/// Holds the uri of the operator or null, in case of single operator setup.
/// Response on cancel reservation request.
Task DoCancelReservationAsync(
string bikeId,
Uri operatorUri);
/// Get authentication keys.
/// Id of the bike to get keys for.
/// Holds the uri of the operator or null, in case of single operator setup.
/// Response holding authentication keys.
Task CalculateAuthKeysAsync(
string bikeId,
Uri operatorUri);
/// Notifies COPRI about start of returning sequence.
/// Operator specific call.
/// Id of the bike to return.+
/// Holds the uri of the operator or null, in case of single operator setup.
/// Response on notification about start of returning sequence.
Task StartReturningBike(
string bikeId,
Uri operatorUri);
/// Updates COPRI lock state for a booked bike.
/// Id of the bike to update locking state for.
/// Geolocation of lock.
/// New locking state.
/// Holds the filling level percentage of the battery.
/// Holds the uri of the operator or null, in case of single operator setup.
/// Response on updating locking state.
Task UpdateLockingStateAsync(
string bikeId,
lock_state state,
Uri operatorUri,
LocationDto location = null,
double batteryPercentage = double.NaN,
IVersionInfo versionInfo = null);
/// Books a bluetooth bike.
/// Id of the bike to book.
/// Used to publish GUID from app to copri. Used for initial setup of bike in copri.
/// Holds the filling level percentage of the battery.
/// Holds the uri of the operator or null, in case of single operator setup.
/// Response on booking request.
Task DoBookAsync(
string bikeId,
Guid guid,
double batteryPercentage,
Uri operatorUri);
/// Books a bike and starts opening bike.
/// Id of the bike to book.
/// Holds the uri of the operator or null, in case of single operator setup.
/// Response on booking request.
Task BookAvailableAndStartOpeningAsync(
string bikeId,
Uri operatorUri);
/// Books a bike and starts opening bike.
/// Id of the bike to book.
/// Holds the uri of the operator or null, in case of single operator setup.
/// Response on booking request.
Task BookReservedAndStartOpeningAsync(
string bikeId,
Uri operatorUri);
/// Returns a bike.
/// Id of the bike to return.
/// Geolocation of lock.
/// Provides info about hard and software.
/// Holds the uri of the operator or null, in case of single operator setup.
/// Response on returning request.
Task DoReturn(
string bikeId,
LocationDto location,
ISmartDevice smartDevice,
Uri operatorUri);
/// 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.
Task ReturnAndStartClosingAsync(
string bikeId,
ISmartDevice smartDevice,
Uri operatorUri);
///
/// Submits feedback to copri server.
///
/// Id of the bike to submit feedback for.
/// Null if bike has no engine or charge is unknown. Otherwise the charge filling level of the drive battery.
/// True if bike is broken.
/// General purpose message or error description.
Task DoSubmitFeedback(
string bikeId,
int? currentChargeBars,
string message,
bool isBikeBroken,
Uri operatorUri);
/// Submits mini survey to copri server.
/// Collection of answers.
Task DoSubmitMiniSurvey(IDictionary answers);
/// True if connector has access to copri server, false if cached values are used.
bool IsConnected { get; }
/// Gets the session cookie if user is logged in, an empty string otherwise.
string SessionCookie { get; }
/// Holds the id of the merchant.
string MerchantId { get; }
}
/// Interface to communicate with copri server.
public interface ICopriServer : ICopriServerBase
{
/// Get list of stations.
/// List of all stations.
Task GetStationsAsync();
/// Gets a list of bikes from Copri.
/// Response holding list of bikes.
Task GetBikesAvailableAsync();
/// Gets a list of bikes reserved/ booked by acctive user from Copri.
/// Response holding list of bikes.
Task GetBikesOccupiedAsync();
}
}