using System; using System.Threading.Tasks; using TINK.Model.Repository.Request; using TINK.Model.Repository.Response; using TINK.Repository.Response; namespace TINK.Model.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( int 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( int 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( int 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( int 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( int bikeId, Guid guid, double batteryPercentage, 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( int bikeId, LocationDto location, Uri operatorUri); /// /// Submits feedback to copri server. /// /// True if bike is broken. /// General purpose message or error description. Task DoSubmitFeedback( 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(); } }