using System; using System.Collections.Generic; using TINK.Model.Bikes.BikeInfoNS.BluetoothLock; using TINK.Model.Device; namespace TINK.Repository.Request { /// Defines members to create requests. public interface IRequestBuilder { /// Holds the id denoting the merchant (TINK app). string MerchantId { get; } /// Gets the session cookie if user is logged in, an empty string otherwise. string SessionCookie { get; } /// Gets request to log user in. /// Mailaddress of user to log in. /// Password to log in. /// Id specifying user and hardware. /// Requst which holds auth cookie string DoAuthorization( string mailAddress, string password, string deviceId); /// Logs user out. /// Id of the merchant. /// Cookie which identifies user. string DoAuthout(); /// Get list of stations from file. /// Request to query list of station. string GetStations(); /// Gets bikes available. /// Request to query list of bikes available. string GetBikesAvailable(); /// Gets a list of bikes reserved/ booked by acctive user from Copri. /// Request to query list of bikes occupied. string GetBikesOccupied(); /// Gets reservation request (synonym: reservation == request == reservieren). /// Id of the bike to reserve. /// Requst to reserve bike. string DoReserve(string bikeId); /// Gets request to cancel reservation. /// Id of the bike to cancel reservation for. /// Requst on cancel booking request. string DoCancelReservation(string bikeId); /// Request to get keys. /// Id of the bike to get keys for. /// Request to get keys. string CalculateAuthParameters(string bikeId); /// Gets the request for notifying about start of returning sequence. /// Operator specific call. /// Id of the bike to return. /// Request to notify about start of returning sequence. string StartReturningBike(string bikeId); /// Gets the request for updating lock state for a booked bike. /// Id of the bike to update locking state for. /// New locking state. /// Geolocation of lock when state change occurred. /// Information about lock (firmware version, hardware version, ...). /// Request to update locking state. string UpateLockingState( string bikeId, lock_state state, LocationDto location = null, double batteryPercentage = double.NaN, IVersionInfo versionInfo = null); /// Gets the booking request (synonym: booking == renting == mieten). /// 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. /// Request to booking bike. string DoBook(string bikeId, Guid guid, double batteryPercentage); /// Gets the request to book and start opening the bike (synonym: booking == renting == mieten). /// Id of the bike to book. /// Request to booking bike. string BookAvailableAndStartOpening(string bikeId); /// Gets the request to book and start opening the bike (synonym: booking == renting == mieten). /// Id of the bike to book. /// Request to booking bike. string BookReservedAndStartOpening(string bikeId); /// Gets request for returning the bike. /// Id of the bike to return. /// Geolocation of lock when returning bike. /// Requst on returning request. string DoReturn(string bikeId, LocationDto location, ISmartDevice smartDevice); /// Returns a bike and starts closing. /// Id of the bike to return. /// Provides info about hard and software. /// Response to send to corpi. string ReturnAndStartClosing(string bikeId, ISmartDevice smartDevice); /// /// Gets request for submiting feedback to copri server. /// /// Id of the bike to which the feedback is related to. /// Null if bike has no engine or charge is unknown. Otherwise the charge filling level of the drive battery. /// General purpose message or error description. /// True if bike is broken. string DoSubmitFeedback( string bikeId, int? currentChargeBars, string message = null, bool isBikeBroken = false); /// /// Gets request for submiting mini survey to copri server. /// /// Collection of answers. string DoSubmitMiniSurvey(IDictionary answers); } /// Copri locking states public enum lock_state { locking, locked, unlocking, unlocked, } /// Holds lockation info. public class LocationDto { public double Latitude { get; private set; } public double Longitude { get; private set; } /// Accuracy of location in meters. public double? Accuracy { get; private set; } public TimeSpan Age { get; private set; } public class Builder { public double Latitude { get; set; } public double Longitude { get; set; } public double? Accuracy { get; set; } public TimeSpan Age { get; set; } public LocationDto Build() { return new LocationDto { Latitude = Latitude, Longitude = Longitude, Accuracy = Accuracy, Age = Age }; } } } }