sharee.bike-App/TINKLib/Repository/Response/BikeInfoBase.cs

113 lines
3.4 KiB
C#
Raw Normal View History

2023-04-19 12:14:14 +02:00
using System.Runtime.Serialization;
2021-05-13 20:03:07 +02:00
2021-06-26 20:57:55 +02:00
namespace TINK.Repository.Response
2021-05-13 20:03:07 +02:00
{
2022-09-06 16:08:19 +02:00
/// <summary>
/// Holds info about a single bike.
/// </summary>
[DataContract]
public class BikeInfoBase
{
/// <summary>
/// Id of the bike.
/// </summary>
[DataMember]
public string bike { get; private set; }
2021-05-13 20:03:07 +02:00
2022-09-06 16:08:19 +02:00
/// <summary>
/// Position of the bike.
/// </summary>
[DataMember]
public Position gps { get; private set; }
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
/// <summary>
/// Id of the station.
/// </summary>
[DataMember]
public string station { get; private set; }
2021-05-13 20:03:07 +02:00
2022-09-06 16:08:19 +02:00
/// <summary>
2023-04-19 12:14:14 +02:00
/// Holds the localized (German) description of the bike.
2022-09-06 16:08:19 +02:00
/// </summary>
[DataMember]
public string description { get; private set; }
2021-05-13 20:03:07 +02:00
2022-09-06 16:08:19 +02:00
/// <summary> Holds the group of the bike.</summary>
/// <remarks>
/// Copri returns values "TINK", "Konrad".
/// </remarks>
[DataMember]
public string[] bike_group { get; private set; }
2021-05-13 20:03:07 +02:00
2022-09-06 16:08:19 +02:00
/// <summary>
/// Rental state.
/// </summary>
[DataMember]
public string state { get; private set; }
2021-05-13 20:03:07 +02:00
2022-09-06 16:08:19 +02:00
/// <summary>
/// Holds the uri where to reserve/ rent the bike.
/// </summary>
[DataMember]
public string uri_operator { get; private set; }
2021-05-13 20:03:07 +02:00
2022-09-06 16:08:19 +02:00
/// <summary> Holds whether bike is equipped with computer or if bike is a lock bike.</summary>
/// <remarks>
/// <table>
/// <tr><th>Value </th><th>Type of bike </th><th>Member to extract info.</th></tr>
/// <tr><td>LOCK </td><td>Bike with manual lock. </td><td>TextToTypeHelper.GetIsNonBikeComputerBike</td></tr>
/// <tr><td>BC </td><td>Bike with a bord computer. </td><td></td></tr>
/// <tr><td>Ilockit </td><td>Bike with a bluetooth lock.</td><td></td></tr>
/// <tr><td>sigo </td><td>Sigo bike.</td><td></td></tr>
/// </table>
/// </remarks>
[DataMember]
public string system { get; private set; }
2021-05-13 20:03:07 +02:00
#if !NOTARIFFDESCRIPTION
2022-09-06 16:08:19 +02:00
/// <summary> Holds the tariff information for a bike. </summary>
/// <remarks> This member is obsolete. Use <cref="rental_description"> instead.</cref></remarks>
[DataMember]
public TariffDescription tariff_description { get; private set; }
2022-06-17 14:17:58 +02:00
2022-09-06 16:08:19 +02:00
/// <summary> Holds the rental information for a bike. </summary>
[DataMember]
public RentalDescription rental_description { get; private set; }
2021-05-13 20:03:07 +02:00
#endif
2022-09-06 16:08:19 +02:00
[DataMember]
/// <summary> Describes type of the bike.</summary>
public BikeType bike_type { get; private set; }
2022-08-30 15:42:25 +02:00
2023-04-19 12:14:14 +02:00
/// <summary>
/// Holds whether bike is a AA bike (bike must be always returned a the same station) or AB bike (start and end stations can be different stations).
/// </summary>
[DataMember]
public string aa_ride { get; private set; }
2022-09-06 16:08:19 +02:00
/// <summary> Loading state of motor battery in % ]0..100[. </summary>
[DataMember]
public string bike_charge { get; private set; }
2021-11-07 21:28:13 +01:00
2022-09-06 16:08:19 +02:00
/// <summary> Locking state of the bike. </summary>
[DataMember]
public string lock_state { get; private set; }
2022-04-25 22:15:15 +02:00
2022-09-06 16:08:19 +02:00
[DataMember]
/// <summary> Full advertisement name.</summary>
public string Ilockit_ID { get; private set; }
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
[DataMember]
/// <summary> Full advertisement name.</summary>
public string Ilockit_GUID { get; private set; }
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
/// <summary>
/// Textual description of response.
/// </summary>
/// <returns>Object as text.</returns>
public new string ToString()
{
return $"Bike {bike}{(station != null ? $", at station {station}" : string.Empty)}{(!string.IsNullOrEmpty(description) ? $", {description}" : string.Empty)}{(!string.IsNullOrEmpty(state) ? $", status={state}" : string.Empty)}.";
}
}
2021-05-13 20:03:07 +02:00
}