Version 3.0.366

This commit is contained in:
Anja 2023-06-06 12:00:24 +02:00
parent 0eb7362cb8
commit 24cdfbb0ca
84 changed files with 900 additions and 393 deletions

View file

@ -21,7 +21,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
private readonly StateInfoMutable _StateInfo;
/// <summary>
/// Constructs a bike.
/// Constructs a bike info object.
/// </summary>
/// <param name="isDemo">True if device is demo device, false otherwise.</param>
/// <param name="dateTimeProvider">Provider for current date time to calculate remaining time on demand for state of type reserved.</param>
@ -38,7 +38,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
string stationId = null,
string stationName = null,
Uri operatorUri = null,
RentalDescription tariffDescription = null,
IRentalDescription tariffDescription = null,
Func<DateTime> dateTimeProvider = null,
IStateInfo stateInfo = null)
{
@ -65,7 +65,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
/// <summary> Holds description about the tariff. </summary>
[DataMember]
public RentalDescription TariffDescription { get; private set; }
public IRentalDescription TariffDescription { get; private set; }
/// <summary>
/// Holds the rent state of the bike.

View file

@ -64,6 +64,11 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
/// <summary> Gets or sets the information where the data origins from. </summary>
DataSource DataSource { get; set; }
/// <summary>
/// Gets or set the rental description.
/// </summary>
IRentalDescription TariffDescription { get; }
event PropertyChangedEventHandler PropertyChanged;
}

View file

@ -83,8 +83,9 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
new StateInfo(
dateTimeProvider,
requestedAt,
tariffDescription?.MaxReservationTimeSpan ?? StateRequestedInfo.UNKNOWNMAXRESERVATIONTIMESPAN,
mailAddress,
""),
"" ), // BC code
bike != null
? new Bike(
bike.Id,

View file

@ -84,8 +84,9 @@ namespace TINK.Model.Bikes.BikeInfoNS.CopriLock
new StateInfo(
dateTimeProvider,
requestedAt,
tariffDescription?.MaxReservationTimeSpan ?? StateRequestedInfo.UNKNOWNMAXRESERVATIONTIMESPAN,
mailAddress,
""),
""), // BC code
bike != null
? new Bike(
bike.Id,

View file

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using static TINK.Model.Bikes.BikeInfoNS.RentalDescription;
namespace TINK.Model.Bikes.BikeInfoNS
{
public interface IRentalDescription
{
/// <summary>
/// Name of the tariff.
/// </summary>
string Name { get; set; }
/// <summary>
/// Holds the time span for which a bike can be reserved.
/// </summary>
TimeSpan MaxReservationTimeSpan { get; set; }
/// <summary>
/// Dynamic language aware tariff elements to be displayed to user.
/// </summary>
Dictionary<string, TariffElement> TariffEntries { get; set; }
/// <summary>
/// Well known language aware elements (AGB, tracking info, ...) to be displayed to user.
/// </summary>
Dictionary<string, InfoElement> InfoEntries { get; set; }
}
}

View file

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
namespace TINK.Model.Bikes.BikeInfoNS
@ -6,20 +7,20 @@ namespace TINK.Model.Bikes.BikeInfoNS
/// Successor of TarifDescription- object.
/// Manages tariff- and rental info.
/// </summary>
public class RentalDescription
public class RentalDescription : IRentalDescription
{
/// <summary>
/// The different elements of a tariff (example: "Max Gebühr", )
/// The different elements of a tariff (example: "Max Gebühr", ) to be displayed by sharee.bike without processing
/// </summary>
public class TariffElement
{
/// <summary>
/// Describes the tariff element. To be displayed to user (example of elements: "Gratis Mietzeit", "Mietgebühr", "Max Gebühr").
/// Describes the tariff element (language aware). To be displayed to user (example of elements: "Gratis Mietzeit", "Mietgebühr", "Max Gebühr").
/// </summary>
public string Description { get; set; } = string.Empty;
/// <summary>
/// Holds the tariff element value. To be displayed to user (example: "9.00 € / Tag").
/// Holds the tariff element value (language aware, i.e. value from backend might be english, german, ... depending on smart phone value). To be displayed to user (example: "9.00 € / Tag").
/// </summary>
public string Value { get; set; } = string.Empty;
}
@ -30,12 +31,12 @@ namespace TINK.Model.Bikes.BikeInfoNS
public class InfoElement
{
/// <summary>
/// Key which identyfies the value (required for special processing)
/// Key which identifies the value (required for special processing)
/// </summary>
public string Key { get; set; }
/// <summary>
/// Text to be displayed to user.
/// Text (language aware) to be displayed to user.
/// </summary>
public string Value { get; set; }
}
@ -50,8 +51,19 @@ namespace TINK.Model.Bikes.BikeInfoNS
/// </summary>
public int? Id { get; set; }
/// <summary>
/// Holds the time span for which a bike can be reserved.
/// </summary>
public TimeSpan MaxReservationTimeSpan { get; set; }
/// <summary>
/// Dynamic language aware tariff elements to be displayed to user.
/// </summary>
public Dictionary<string, TariffElement> TariffEntries { get; set; } = new Dictionary<string, TariffElement>();
/// <summary>
/// Well known language aware elements (AGB, tracking info, ...) to be displayed to user.
/// </summary>
public Dictionary<string, InfoElement> InfoEntries { get; set; } = new Dictionary<string, InfoElement>();
}
}