import Foundation

/// Errors that can occur in the App Clip.
enum ClipError: Error, LocalizedError {
    case fetchFailed
    case invalidRecord
    case expired
    case contactSaveFailed
    case contactsAccessDenied

    var errorDescription: String? {
        switch self {
        case .fetchFailed:
            return String(localized: "Could not load card")
        case .invalidRecord:
            return String(localized: "Invalid card data")
        case .expired:
            return String(localized: "This card has expired")
        case .contactSaveFailed:
            return String(localized: "Failed to save contact")
        case .contactsAccessDenied:
            return String(localized: "Contacts access required")
        }
    }
}
