mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-23 07:36:31 +01:00
42 lines
1.5 KiB
C#
42 lines
1.5 KiB
C#
|
using System.Runtime.Serialization;
|
||
|
using Newtonsoft.Json;
|
||
|
using ShareeBike.Repository.Response.Stations.Station;
|
||
|
|
||
|
namespace ShareeBike.Repository.Response.Stations
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Holds the information about all stations and is used for deserialization of copri answer.
|
||
|
/// </summary>
|
||
|
[DataContract]
|
||
|
public class StationsAvailableResponse : ResponseBase
|
||
|
{
|
||
|
public StationsAvailableResponse()
|
||
|
{
|
||
|
stations = new ComparableDictionary< StationInfo>();
|
||
|
bikes_occupied = new ComparableBikeDictionary<BikeInfoReservedOrBooked> { };
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Dictionary of bikes.
|
||
|
/// </summary>
|
||
|
[DataMember]
|
||
|
public ComparableDictionary< StationInfo> stations { get; private set; }
|
||
|
|
||
|
/// <summary>
|
||
|
/// Dictionary of bikes reserved (requested) and rented (occupied) by current user if user is logged in and has reserved or rented bikes.
|
||
|
/// </summary>
|
||
|
[DataMember]
|
||
|
public ComparableBikeDictionary<BikeInfoReservedOrBooked> bikes_occupied { get; private set; }
|
||
|
|
||
|
public static bool operator ==(StationsAvailableResponse first, StationsAvailableResponse second)
|
||
|
=> JsonConvert.SerializeObject(first) == JsonConvert.SerializeObject(second);
|
||
|
|
||
|
public static bool operator !=(StationsAvailableResponse first, StationsAvailableResponse second)
|
||
|
=> !(first == second);
|
||
|
|
||
|
public override bool Equals(object obj) => obj is StationsAvailableResponse target && target == this;
|
||
|
|
||
|
public override int GetHashCode() => JsonConvert.SerializeObject(this).GetHashCode();
|
||
|
}
|
||
|
}
|