using System; using System.Collections.Generic; using System.Threading.Tasks; using ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock; using ShareeBike.Model.Connector; using ShareeBike.Repository.Request; using ShareeBike.Repository.Response; using ShareeBike.Repository.Response.Stations; namespace ShareeBike.Repository { /// Interface to communicate with copri server. public interface ICopriServerBase { /// Logs user in. /// Mail address 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 bike. /// 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. /// Holds the uri of the operator or null, in case of single operator setup. /// 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. /// If not null next locking action which is performed after booking. /// Response on booking request. Task DoBookAsync( Uri operatorUri, string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null); /// 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. /// Holds the uri of the operator or null, in case of single operator setup. /// Response on returning request. Task DoReturn( string bikeId, LocationDto location, 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, 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. /// 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. Task GetBikesAvailableAsync(Uri operatorUri = null, string stationId = null, string bikeId = null); /// Gets a list of bikes reserved/ booked by active user from Copri. /// Response holding list of bikes. Task GetBikesOccupiedAsync(); } }