mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-16 15:16:34 +01:00
47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
using System;
|
|
|
|
namespace TINK.Model.Bikes.BikeInfoNS.CopriLock
|
|
{
|
|
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);
|
|
|
|
BookingFinishedModel = new BookingFinishedModel
|
|
{
|
|
Co2Saving = bike.Co2Saving,
|
|
MiniSurvey = new MiniSurvey.MiniSurveyModel()
|
|
};
|
|
|
|
if ((bike?.MiniSurvey?.Questions) == null
|
|
|| bike.MiniSurvey.Questions.Count <= 0)
|
|
{
|
|
// No querries to add.
|
|
return;
|
|
}
|
|
|
|
// Add a dummy querry. Querries are not yet read from COPRI but compiled into the app.
|
|
BookingFinishedModel.MiniSurvey.Questions.Add("q1", new MiniSurvey.QuestionModel());
|
|
}
|
|
|
|
public LockInfoMutable LockInfo { get; }
|
|
|
|
ILockInfoMutable IBikeInfoMutable.LockInfo => LockInfo;
|
|
|
|
public IBookingFinishedModel BookingFinishedModel { get; }
|
|
}
|
|
}
|