sharee.bike-App/TINKLib/Model/Bikes/BikeInfoNS/DriveNS/Drive.cs

63 lines
C#
Raw Normal View History

2022-08-30 15:42:25 +02:00
using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
using TINK.Model.Bikes.BikeInfoNS.DriveNS.EngineNS;
namespace TINK.Model.Bikes.BikeInfoNS.DriveNS
{
2022-09-06 16:08:19 +02:00
public enum DriveType
{
/// <summary>
/// Bike without pedalling aid.
/// </summary>
SoleHumanPowered,
/// <summary>
/// pedal electric cycle: Pedalling is assisted by an electric engine.
/// </summary>
Pedelec
}
public class Drive
{
public Drive(
IEngine engine = null,
IBattery battery = null)
{
if (engine == null)
{
Engine = new Engine();
Battery = new Battery.Builder().Build();
Type = DriveType.SoleHumanPowered;
return;
}
Engine = engine;
Battery = battery ?? new Battery.Builder().Build();
Type = DriveType.Pedelec;
}
/// <summary>
/// Gets the type of the drive.
/// </summary>
public DriveType Type { get; private set; }
/// <summary>
/// Engine driving the bike.
/// </summary>
public IEngine Engine { get; private set; }
/// <summary>
/// Battery powering the engine.
/// </summary>
public IBattery _Battery = new Battery.Builder().Build();
/// <summary>
/// Battery powering the engine.
/// </summary>
public IBattery Battery
{
get => _Battery;
set => _Battery = value ?? new Battery.Builder().Build();
}
}
2022-08-30 15:42:25 +02:00
}