using System;
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 updating lock state for a booked bike.
/// Id of the bike to update locking state for.
/// Geolocation of lock when state change occurred.
/// New locking state.
/// Request to update locking state.
string UpateLockingState(
string bikeId,
LocationDto location,
lock_state state,
double batteryPercentage);
/// Gets booking request 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 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);
///
/// Gets request for submiting feedback to copri server.
///
/// Id of the bike to which the feedback is related to.
/// General purpose message or error description.
/// True if bike is broken.
string DoSubmitFeedback(string bikeId, string message = null, bool isBikeBroken = false);
}
/// Copri locking states
public enum lock_state
{
locked,
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 };
}
}
}
}