sharee.bike-App/TINKLib/Model/Bikes/BikeInfoNS/CopriLock/BikeInfoMutable.cs

49 lines
1.2 KiB
C#
Raw Normal View History

2023-01-18 14:22:51 +01:00
using System;
2022-08-30 15:42:25 +02:00
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,
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.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
2023-04-19 12:14:14 +02:00
// Add a dummy query. Querries are not yet read from COPRI but compiled into the app.
2022-09-06 16:08:19 +02:00
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
}