2023-05-09 08:47:52 +02:00
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
|
2024-04-09 12:53:23 +02:00
|
|
|
namespace ShareeBike.Model.Stations.StationNS.Operator
|
2023-05-09 08:47:52 +02:00
|
|
|
{
|
|
|
|
public class BikeGroupCol : List<BikeGroupCol.Entry> , IBikeGroupCol
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Holds a group of bikes at a station.
|
|
|
|
/// </summary>
|
|
|
|
public class Entry
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Bike group entry.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="name">Name of the group, either "Citybikes" or "Cargobikes".</param>
|
|
|
|
/// <param name="availableCount"></param>
|
|
|
|
/// <param name="group"></param>
|
|
|
|
public Entry(string name, int? availableCount = null, string group = null)
|
|
|
|
{
|
|
|
|
Name = name;
|
|
|
|
AvailableCount = availableCount ?? 0;
|
|
|
|
Group = group ?? string.Empty;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Name of the group, either "Citybikes" or "Cargobikes".
|
|
|
|
/// </summary>
|
|
|
|
public string Name { get; }
|
|
|
|
|
|
|
|
/// <summary> Holds the count of bikes available of given type at station. </summary>
|
|
|
|
public int AvailableCount { get; }
|
|
|
|
|
|
|
|
/// <summary>
|
2024-04-09 12:53:23 +02:00
|
|
|
/// Holds the group of the bikes. Citybike separates cargo and city bikes by group.
|
2023-05-09 08:47:52 +02:00
|
|
|
/// </summary>
|
|
|
|
public string Group { get; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public BikeGroupCol() : base() { }
|
|
|
|
|
|
|
|
public BikeGroupCol(IEnumerable<Entry> source) : base(source) { }
|
|
|
|
|
|
|
|
/// <summary> Holds the count of bikes available of any type at station. </summary>
|
|
|
|
public int AvailableCount => this.Select(x => x.AvailableCount).Sum();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|