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