using System.Runtime.Serialization; using Newtonsoft.Json; using ShareeBike.Repository.Response.Stations.Station; namespace ShareeBike.Repository.Response.Stations { /// /// Holds the information about all stations and is used for deserialization of copri answer. /// [DataContract] public class StationsAvailableResponse : ResponseBase { public StationsAvailableResponse() { stations = new ComparableDictionary< StationInfo>(); bikes_occupied = new ComparableBikeDictionary { }; } /// /// Dictionary of bikes. /// [DataMember] public ComparableDictionary< StationInfo> stations { get; private set; } /// /// Dictionary of bikes reserved (requested) and rented (occupied) by current user if user is logged in and has reserved or rented bikes. /// [DataMember] public ComparableBikeDictionary bikes_occupied { get; private set; } public static bool operator ==(StationsAvailableResponse first, StationsAvailableResponse second) => JsonConvert.SerializeObject(first) == JsonConvert.SerializeObject(second); public static bool operator !=(StationsAvailableResponse first, StationsAvailableResponse second) => !(first == second); public override bool Equals(object obj) => obj is StationsAvailableResponse target && target == this; public override int GetHashCode() => JsonConvert.SerializeObject(this).GetHashCode(); } }