using System.Text.Json.Serialization; namespace DatabaseSnapshotsService.Models { public class SnapshotConfiguration { [JsonPropertyName("connectionString")] public string ConnectionString { get; set; } = "Server=localhost;Database=trading;Uid=root;Pwd=password;"; [JsonPropertyName("binlogReader")] public BinlogReaderConfig BinlogReader { get; set; } = new(); [JsonPropertyName("snapshotStorage")] public SnapshotStorageConfig SnapshotStorage { get; set; } = new(); [JsonPropertyName("eventStore")] public EventStoreConfig EventStore { get; set; } = new(); [JsonPropertyName("security")] public SecurityConfig Security { get; set; } = new(); } public class SecurityConfig { [JsonPropertyName("encryption")] public bool Encryption { get; set; } = false; [JsonPropertyName("encryptionKey")] public string? EncryptionKey { get; set; } } public class BinlogReaderConfig { [JsonPropertyName("host")] public string Host { get; set; } = "localhost"; [JsonPropertyName("port")] public int Port { get; set; } = 3306; [JsonPropertyName("username")] public string Username { get; set; } = "binlog_reader"; [JsonPropertyName("password")] public string Password { get; set; } = "secure_password"; [JsonPropertyName("serverId")] public int ServerId { get; set; } = 999; [JsonPropertyName("startPosition")] public long StartPosition { get; set; } = 4; [JsonPropertyName("heartbeatInterval")] public int HeartbeatInterval { get; set; } = 30; } public class SnapshotStorageConfig { [JsonPropertyName("path")] public string Path { get; set; } = "./snapshots"; [JsonPropertyName("compression")] public bool Compression { get; set; } = true; [JsonPropertyName("retentionDays")] public int RetentionDays { get; set; } = 30; [JsonPropertyName("maxFileSize")] public long MaxFileSize { get; set; } = 100 * 1024 * 1024; // 100MB [JsonPropertyName("dumpOptimizations")] public DumpOptimizationConfig DumpOptimizations { get; set; } = new(); } public class DumpOptimizationConfig { [JsonPropertyName("singleTransaction")] public bool SingleTransaction { get; set; } = true; [JsonPropertyName("includeRoutines")] public bool IncludeRoutines { get; set; } = true; [JsonPropertyName("includeTriggers")] public bool IncludeTriggers { get; set; } = true; [JsonPropertyName("includeEvents")] public bool IncludeEvents { get; set; } = true; [JsonPropertyName("extendedInsert")] public bool ExtendedInsert { get; set; } = true; [JsonPropertyName("completeInsert")] public bool CompleteInsert { get; set; } = true; [JsonPropertyName("hexBlob")] public bool HexBlob { get; set; } = true; [JsonPropertyName("netBufferLength")] public int NetBufferLength { get; set; } = 16384; [JsonPropertyName("maxAllowedPacket")] public string MaxAllowedPacket { get; set; } = "1G"; [JsonPropertyName("excludeTables")] public List ExcludeTables { get; set; } = new(); [JsonPropertyName("includeTables")] public List IncludeTables { get; set; } = new(); // New options [JsonPropertyName("quick")] public bool Quick { get; set; } = true; [JsonPropertyName("orderByPrimary")] public bool OrderByPrimary { get; set; } = true; [JsonPropertyName("flushLogs")] public bool FlushLogs { get; set; } = true; [JsonPropertyName("masterData")] public int MasterData { get; set; } = 2; [JsonPropertyName("compact")] public bool Compact { get; set; } = false; [JsonPropertyName("noAutocommit")] public bool NoAutocommit { get; set; } = false; [JsonPropertyName("lockTables")] public bool LockTables { get; set; } = false; } public class EventStoreConfig { [JsonPropertyName("path")] public string Path { get; set; } = "./events"; [JsonPropertyName("maxFileSize")] public long MaxFileSize { get; set; } = 50 * 1024 * 1024; // 50MB [JsonPropertyName("retentionDays")] public int RetentionDays { get; set; } = 90; [JsonPropertyName("batchSize")] public int BatchSize { get; set; } = 1000; [JsonPropertyName("flushInterval")] public int FlushInterval { get; set; } = 5; // seconds } }