using System;
using System.Threading.Tasks;
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);
/// 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,
LocationDto location,
lock_state state,
double batteryPercentage,
Uri operatorUri);
/// Books a 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);
/// 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);
///
/// Submits feedback to copri server.
///
/// Id of the bike to submit feedback for.
/// True if bike is broken.
/// General purpose message or error description.
Task DoSubmitFeedback(
string bikeId,
string message,
bool isBikeBroken,
Uri operatorUri);
/// 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();
}
}