import Foundation enum BackupError: LocalizedError { case connectionFailed(String) case authenticationFailed case photoLibraryDenied case uploadFailed(String, underlying: Error) case directoryListFailed(String) case directoryCreateFailed(String) case cancelled case timeout case networkUnavailable var errorDescription: String? { switch self { case .connectionFailed(let host): return "Could not connect to \(host)" case .authenticationFailed: return "Authentication failed — check username and password" case .photoLibraryDenied: return "Photos access denied — update in iOS Settings" case .uploadFailed(let file, _): return "Failed to upload \(file)" case .directoryListFailed(let path):return "Could not list \(path)" case .directoryCreateFailed(let p): return "Could not create folder at \(p)" case .cancelled: return "Backup was cancelled" case .timeout: return "Operation timed out" case .networkUnavailable: return "Network not available" } } }