mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-05 10:36:30 +01:00
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using System.Runtime.Serialization;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace ShareeBike.Repository.Response
|
|
{
|
|
/// <summary>
|
|
/// Holds the information about all bikes and is used for deserialization of copri answer.
|
|
/// </summary>
|
|
[DataContract]
|
|
[JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)]
|
|
public class BikesAvailableResponse : ResponseBase
|
|
{
|
|
public BikesAvailableResponse()
|
|
{
|
|
bikes = new ComparableBikeDictionary<BikeInfoAvailable> ();
|
|
bikes_occupied = new ComparableBikeDictionary<BikeInfoReservedOrBooked> ();
|
|
}
|
|
|
|
/// <summary> Dictionary of bikes available.</summary>
|
|
[DataMember]
|
|
public ComparableBikeDictionary<BikeInfoAvailable> bikes { get; private set; }
|
|
|
|
/// <summary> Dictionary of bikes reserved or booked.</summary>
|
|
[DataMember]
|
|
public ComparableBikeDictionary<BikeInfoReservedOrBooked> bikes_occupied { get; private set; }
|
|
|
|
public static bool operator== (BikesAvailableResponse first, BikesAvailableResponse second)
|
|
=> JsonConvert.SerializeObject(first) == JsonConvert.SerializeObject(second);
|
|
|
|
public static bool operator !=(BikesAvailableResponse first, BikesAvailableResponse second)
|
|
=> !(first == second);
|
|
|
|
public override bool Equals(object obj) => obj is BikesAvailableResponse target && target == this;
|
|
|
|
public override int GetHashCode() => JsonConvert.SerializeObject(this).GetHashCode();
|
|
}
|
|
}
|