using System.ComponentModel; using System.IO; using System.Xml.Serialization; namespace PolyTraderSharp.Models { public class ServerSettings { [Category("Threema Notifications")] [DisplayName("Threema Enabled")] [Description("Enable or disable Threema notifications.")] public bool ThreemaEnabled { get; set; } = true; [Category("Threema Notifications")] [DisplayName("Gateway ID")] [Description("The Threema Gateway ID (e.g. *3MAGW01).")] public string ThreemaGatewayId { get; set; } = "*3MAGW01"; [Category("Threema Notifications")] [DisplayName("Gateway Secret")] [Description("The secret for the Threema Gateway integration.")] public string ThreemaSecret { get; set; } = ""; [Category("Threema Notifications")] [DisplayName("Private Key")] [Description("The Private Key (hex) for End-to-End encryption.")] public string ThreemaPrivateKey { get; set; } = ""; [Category("Threema Notifications")] [DisplayName("Group ID")] [Description("The Threema Group ID to send messages to.")] public string ThreemaGroupId { get; set; } = ""; [Category("Threema Notifications")] [DisplayName("Webhook Port")] [Description("The local port to listen on for incoming Threema messages (e.g. 8080).")] public int ThreemaWebhookPort { get; set; } = 8080; [Category("Threema Notifications")] [DisplayName("Report Interval (Hours)")] [Description("Interval for the automatic summary report.")] public int ThreemaReportIntervalHours { get; set; } = 6; [Category("Mullvad VPN")] [DisplayName("VPN Enabled")] [Description("Enable or disable automatic VPN rotation.")] public bool VpnEnabled { get; set; } = false; [Category("Mullvad VPN")] [DisplayName("Mullvad Account")] [Description("Account ID for Mullvad VPN.")] public string MullvadAccount { get; set; } = "7748925650632296"; [Category("Mullvad VPN")] [DisplayName("VPN Location")] [Description("Target VPN location (e.g. cz).")] public string VpnLocation { get; set; } = "cz"; [Category("Mullvad VPN")] [DisplayName("Mullvad CLI Path")] [Description("Path to mullvad.exe")] public string MullvadCliPath { get; set; } = @"C:\Program Files\Mullvad VPN\resources\mullvad.exe"; [Category("Blockchain Listener")] [DisplayName("Enable Blockchain Listener")] [Description("If true, connects to Alchemy WSS for faster on-chain signal detection.")] public bool EnableBlockchainListener { get; set; } = true; [Category("Blockchain Listener")] [DisplayName("Polygon RPC URL")] [Description("RPC URL for Alchemy WSS.")] public string PolygonRpcUrl { get; set; } = "wss://polygon-mainnet.g.alchemy.com/v2/iWCbs9p3nf-8OpR-BtvGi"; [Category("Polymarket WebSockets")] [DisplayName("Use Polymarket WebSockets")] [Description("If true, connects to Polymarket WSS for live market prices and user events.")] public bool UsePolymarketWebsockets { get; set; } = false; public static ServerSettings Load(string path) { if (!File.Exists(path)) return new ServerSettings(); try { var serializer = new XmlSerializer(typeof(ServerSettings)); using var fs = new FileStream(path, FileMode.Open); return (ServerSettings?)serializer.Deserialize(fs) ?? new ServerSettings(); } catch { return new ServerSettings(); } } public void Save(string path) { var serializer = new XmlSerializer(typeof(ServerSettings)); using var fs = new FileStream(path, FileMode.Create); serializer.Serialize(fs, this); } } }