import Foundation enum APIError: LocalizedError { case invalidResponse case unauthorized case server(status: Int, message: String?) var errorDescription: String? { switch self { case .invalidResponse: return "Ungültige Server-Antwort." case .unauthorized: return "Bitte erneut anmelden." case .server(let status, let message): if let msg = message, !msg.isEmpty { return msg } return "Fehler vom Server (HTTP \(status))." } } } extension Notification.Name { /// Posted when any API call returns HTTP 401 — AuthSession listens and /// logs out so the user lands back on the LoginView. static let apiUnauthorized = Notification.Name("BanYaroGo.apiUnauthorized") }