2022-08-30 15:42:25 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace TINK.Model.Bikes.BikeInfoNS.CopriLock
|
|
|
|
|
{
|
2022-09-06 16:08:19 +02:00
|
|
|
|
public class BikeInfoMutable : BC.BikeInfoMutable, IBikeInfoMutable
|
|
|
|
|
{
|
|
|
|
|
/// <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,
|
|
|
|
|
bike.IsDemo,
|
|
|
|
|
bike.Group,
|
|
|
|
|
bike.StationId,
|
|
|
|
|
stationName,
|
|
|
|
|
bike.OperatorUri,
|
|
|
|
|
bike.TariffDescription,
|
|
|
|
|
() => DateTime.Now,
|
|
|
|
|
bike.State)
|
|
|
|
|
{
|
|
|
|
|
LockInfo = new LockInfoMutable(bike.LockInfo.State);
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
BookingFinishedModel = new BookingFinishedModel
|
|
|
|
|
{
|
|
|
|
|
Co2Saving = bike.Co2Saving,
|
|
|
|
|
MiniSurvey = new MiniSurvey.MiniSurveyModel()
|
|
|
|
|
};
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
if ((bike?.MiniSurvey?.Questions) == null
|
|
|
|
|
|| bike.MiniSurvey.Questions.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
// No querries to add.
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
// Add a dummy querry. Querries are not yet read from COPRI but compiled into the app.
|
|
|
|
|
BookingFinishedModel.MiniSurvey.Questions.Add("q1", new MiniSurvey.QuestionModel());
|
|
|
|
|
}
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
public LockInfoMutable LockInfo { get; }
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
ILockInfoMutable IBikeInfoMutable.LockInfo => LockInfo;
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
public IBookingFinishedModel BookingFinishedModel { get; }
|
|
|
|
|
}
|
2022-08-30 15:42:25 +02:00
|
|
|
|
}
|