// Copyright (c) 2023 schick Informatik // Description: Data model for search filters // using BreCalClient.misc.Model; using System; using System.Collections.Generic; using Newtonsoft.Json; namespace BreCalClient { internal class SearchFilterModel { public SearchFilterModel() { } #region Properties public DateTime? EtaFrom { get; set; } public DateTime? EtaTo { get; set; } public List Categories { get; set; } = new(); public List Agencies { get; set; } = new(); public List Berths { get; set; } = new(); public List Ports { get; set; } = new(); public string? SearchString { get; set; } public double? ShipLengthFrom { get; set; } public double? ShipLengthTo { get; set; } public bool? MineOnly { get; set; } public static Dictionary? filterMap = new(); #endregion #region Serialisation public static bool Deserialize(string json) { filterMap = (Dictionary?) JsonConvert.DeserializeObject(json, typeof(Dictionary)); return (filterMap != null); } public static string Serialize() { return JsonConvert.SerializeObject(filterMap, Formatting.Indented); } #endregion } }