using MikrotikInstaller.Core.Backup; namespace MikrotikInstaller.App.ViewModels.Steps; /// Ein auswählbares Backup im "Backup wiederherstellen"-Zweig der Zusammenfassung, mit Kompatibilitäts-Anzeige. public sealed class BackupSelectionItemViewModel { public BackupSelectionItemViewModel(BackupFileInfo backup, string? currentBoardModel, string? currentSerialNumber) { Backup = backup; Compatibility = BackupRestoreService.CheckCompatibility(backup, currentBoardModel, currentSerialNumber); } public BackupFileInfo Backup { get; } public string FileName => Backup.FileName; /// Lokale Zeit, "?" falls das Gerät kein auswertbares Erstellungsdatum geliefert hat. public string CreationTimeLabel => Backup.CreationTime?.LocalDateTime.ToString("g") ?? "?"; public BackupCompatibility Compatibility { get; } public bool Matches => Compatibility == BackupCompatibility.Match; public bool IsUnknown => Compatibility == BackupCompatibility.Unknown; public string StatusLabel => Compatibility switch { BackupCompatibility.Match => "Passt zu diesem Gerät", BackupCompatibility.Mismatch when Backup.SerialNumber is not null => "Anderes physisches Gerät (andere Seriennummer) — kann nicht wiederhergestellt werden", BackupCompatibility.Mismatch => $"Anderes Gerätemodell ({Backup.Model}) — kann nicht wiederhergestellt werden", _ => "Gerät nicht prüfbar — muss manuell bestätigt werden", }; }