using System.Runtime.Serialization; using Newtonsoft.Json; namespace ShareeBike.Repository.Response { /// /// Holds the information about a booking request (reserve, cancel reservation, book or cancel booking) and is used for deserialization of copri answer. /// [DataContract] [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] public class BikesReservedOccupiedResponse : BookingActionResponse { public BikesReservedOccupiedResponse() { bikes_occupied = new ComparableBikeDictionary (); } /// /// Dictionary of bikes. /// [DataMember] public ComparableBikeDictionary 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(); } }