using System; namespace TINK.Model.Bikes.BikeInfoNS.CopriLock { public class BikeInfoMutable : BC.BikeInfoMutable, IBikeInfoMutable { /// Constructs a bike object from source. public BikeInfoMutable(BikeInfo bike, string stationName) : base( bike != null ? bike.Bike : throw new ArgumentNullException(nameof(bike)), bike.Drive, bike.DataSource, 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; } } }