sharee.bike-App/SharedBusinessLogic/Repository/Response/BikesReservedOccupiedResponse.cs
2024-04-09 12:53:23 +02:00

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();
}
}