2023-01-18 14:22:51 +01:00
|
|
|
using System;
|
2021-05-13 20:03:07 +02:00
|
|
|
|
2022-08-30 15:42:25 +02:00
|
|
|
namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
2021-05-13 20:03:07 +02:00
|
|
|
{
|
2023-01-18 14:22:51 +01:00
|
|
|
public class BikeInfoMutable : BC.BikeInfoMutable, IBikeInfoMutable
|
2022-09-06 16:08:19 +02:00
|
|
|
{
|
|
|
|
/// <summary> Constructs a bike object from source. </summary>
|
|
|
|
public BikeInfoMutable(BikeInfo bike, string stationName) : base(
|
|
|
|
bike != null
|
|
|
|
? bike.Bike
|
|
|
|
: throw new ArgumentNullException(nameof(bike)),
|
|
|
|
bike.Drive,
|
2023-01-18 14:22:51 +01:00
|
|
|
bike.DataSource,
|
2022-09-06 16:08:19 +02:00
|
|
|
bike.IsDemo,
|
|
|
|
bike.Group,
|
|
|
|
bike.StationId,
|
|
|
|
stationName,
|
|
|
|
bike.OperatorUri,
|
|
|
|
bike.TariffDescription,
|
|
|
|
() => DateTime.Now,
|
|
|
|
bike.State)
|
|
|
|
{
|
|
|
|
LockInfo = new LockInfoMutable(
|
|
|
|
bike.LockInfo.Id,
|
|
|
|
bike.LockInfo.Guid,
|
|
|
|
bike.LockInfo.UserKey,
|
|
|
|
bike.LockInfo.AdminKey,
|
|
|
|
bike.LockInfo.Seed,
|
|
|
|
bike.LockInfo.State);
|
|
|
|
}
|
2021-05-13 20:03:07 +02:00
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
public LockInfoMutable LockInfo { get; }
|
2021-05-13 20:03:07 +02:00
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
ILockInfoMutable IBikeInfoMutable.LockInfo => LockInfo;
|
|
|
|
|
|
|
|
public new string ToString()
|
|
|
|
{
|
2023-02-22 14:03:35 +01:00
|
|
|
return $"Id={Id}{(TypeOfBike != null ? $";type={TypeOfBike}" : "")};state={State.ToString()}";
|
2022-09-06 16:08:19 +02:00
|
|
|
}
|
|
|
|
}
|
2021-05-13 20:03:07 +02:00
|
|
|
}
|