using System.Runtime.Serialization; using Newtonsoft.Json; namespace ShareeBike.Repository.Response { /// /// Holds the information about all bikes and is used for deserialization of copri answer. /// [DataContract] [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] public class BikesAvailableResponse : ResponseBase { public BikesAvailableResponse() { bikes = new ComparableBikeDictionary (); bikes_occupied = new ComparableBikeDictionary (); } /// Dictionary of bikes available. [DataMember] public ComparableBikeDictionary bikes { get; private set; } /// Dictionary of bikes reserved or booked. [DataMember] public ComparableBikeDictionary 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(); } }