/** * DailyNotificationErrorCodes.swift * * Error code constants matching Android implementation * * @author Matthew Raymer * @version 1.0.0 */ import Foundation /** * Error code constants matching Android error handling * * These error codes must match Android's error response format: * { * "error": "error_code", * "message": "Human-readable error message" * } */ struct DailyNotificationErrorCodes { // MARK: - Permission Errors static let NOTIFICATIONS_DENIED = "notifications_denied" static let BACKGROUND_REFRESH_DISABLED = "background_refresh_disabled" static let PERMISSION_DENIED = "permission_denied" // MARK: - Configuration Errors static let INVALID_TIME_FORMAT = "invalid_time_format" static let INVALID_TIME_VALUES = "invalid_time_values" static let CONFIGURATION_FAILED = "configuration_failed" static let MISSING_REQUIRED_PARAMETER = "missing_required_parameter" // MARK: - Scheduling Errors static let SCHEDULING_FAILED = "scheduling_failed" static let TASK_SCHEDULING_FAILED = "task_scheduling_failed" static let NOTIFICATION_SCHEDULING_FAILED = "notification_scheduling_failed" // MARK: - Storage Errors static let STORAGE_ERROR = "storage_error" static let DATABASE_ERROR = "database_error" // MARK: - Network Errors (Phase 3) static let NETWORK_ERROR = "network_error" static let FETCH_FAILED = "fetch_failed" static let TIMEOUT = "timeout" // MARK: - System Errors static let PLUGIN_NOT_INITIALIZED = "plugin_not_initialized" static let INTERNAL_ERROR = "internal_error" static let SYSTEM_ERROR = "system_error" // MARK: - Helper Methods /** * Create error response dictionary * * @param code Error code * @param message Human-readable error message * @return Error response dictionary */ static func createErrorResponse(code: String, message: String) -> [String: Any] { return [ "error": code, "message": message ] } /** * Create error response for missing parameter * * @param parameter Parameter name * @return Error response dictionary */ static func missingParameter(_ parameter: String) -> [String: Any] { return createErrorResponse( code: MISSING_REQUIRED_PARAMETER, message: "Missing required parameter: \(parameter)" ) } /** * Create error response for invalid time format * * @return Error response dictionary */ static func invalidTimeFormat() -> [String: Any] { return createErrorResponse( code: INVALID_TIME_FORMAT, message: "Invalid time format. Use HH:mm" ) } /** * Create error response for notifications denied * * @return Error response dictionary */ static func notificationsDenied() -> [String: Any] { return createErrorResponse( code: NOTIFICATIONS_DENIED, message: "Notification permissions denied" ) } }