sharee.bike-App/SharedBusinessLogic/Model/Stations/StationNS/Station.cs
2024-04-09 12:53:23 +02:00

60 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using ShareeBike.Model.Stations.StationNS.Operator;
namespace ShareeBike.Model.Stations.StationNS
{
/// <summary> Holds station info. </summary>
public class Station : IStation
{
/// <summary> Constructs a station object.</summary>
/// <param name="id">Id of the station.</param>
/// <param name="group">Group (ShareeBike, Citybike) to which station is related.</param>
/// <param name="position">GPS- position of the station.</param>
/// <param name="stationName">Name of the station.</param>
/// <param name="operatorUri">Uri of the operator or null.</param>
public Station(
string id,
IEnumerable<string> group = null,
IPosition position = null,
string stationName = "",
Uri operatorUri = null,
IData operatorData = null,
IBikeGroupCol bikeGropCol = null)
{
Id = id;
Group = group ?? throw new ArgumentException("Can not construct station object. Group of stations must not be null.");
Position = position;
StationName = stationName ?? string.Empty;
OperatorData = operatorData ?? new Data();
BikeGroups = bikeGropCol ?? new BikeGroupCol();
OperatorUri = operatorUri;
}
/// <summary> Holds the unique id of the station.c</summary>
public string Id { get; }
/// <summary> Holds the group to which the station belongs.</summary>
public IEnumerable<string> Group { get; }
/// <summary> Gets the name of the station.</summary>
public string StationName { get; }
/// <summary> Holds the gps- position of the station.</summary>
public IPosition Position { get; }
/// <summary> Holds operator related info.</summary>
public IData OperatorData { get; }
/// <summary> Gets the count of bikes available at station. </summary>
public int? AvailableBikesCount => BikeGroups.AvailableCount;
/// <summary> Gets bike <see cref="BikeGroupCol.Entry"/> objects. </summary>
/// <remarks> Each entry has a name, holds the count of available bikes at station and the group value. /// </remarks>
public IBikeGroupCol BikeGroups { get; }
/// <summary> Uri of the operator or null. </summary>
public Uri OperatorUri { get; }
}
}