diff --git a/apps/HeartCoach/Shared/Models/ProactiveNotificationType.swift b/apps/HeartCoach/Shared/Models/ProactiveNotificationType.swift new file mode 100644 index 0000000..fd756f2 --- /dev/null +++ b/apps/HeartCoach/Shared/Models/ProactiveNotificationType.swift @@ -0,0 +1,43 @@ +// ProactiveNotificationType.swift +// ThumpCore +// +// Shared proactive notification identifiers and metadata. +// Used by both iOS notification scheduling and shared persistence. +// +// Platforms: iOS 17+, watchOS 10+ + +import Foundation + +/// All proactive notification types added by the gap analysis. +enum ProactiveNotificationType: String, Sendable, CaseIterable { + case morningBriefing + case bedtimeWindDown + case postWorkoutRecovery + case trainingOpportunity + case illnessDetection + case eveningRecovery + case reboundConfirmation + + var threadIdentifier: String { + "com.thump.alerts.\(rawValue)" + } + + /// Stable identifier — one per type, no UUID, so scheduling replaces + /// any existing pending notification of the same type. + var notificationIdentifier: String { + "com.thump.\(rawValue)" + } + + /// Priority for daily budget arbitration (higher = more important). + var priority: Int { + switch self { + case .illnessDetection: return 100 + case .morningBriefing: return 90 + case .reboundConfirmation: return 80 + case .trainingOpportunity: return 70 + case .eveningRecovery: return 60 + case .bedtimeWindDown: return 50 + case .postWorkoutRecovery: return 40 + } + } +} diff --git a/apps/HeartCoach/iOS/Services/ProactiveNotificationService.swift b/apps/HeartCoach/iOS/Services/ProactiveNotificationService.swift index c3a7c09..be73652 100644 --- a/apps/HeartCoach/iOS/Services/ProactiveNotificationService.swift +++ b/apps/HeartCoach/iOS/Services/ProactiveNotificationService.swift @@ -13,42 +13,6 @@ import Foundation import UserNotifications -// MARK: - Notification Types - -/// All proactive notification types added by the gap analysis. -enum ProactiveNotificationType: String, Sendable, CaseIterable { - case morningBriefing - case bedtimeWindDown - case postWorkoutRecovery - case trainingOpportunity - case illnessDetection - case eveningRecovery - case reboundConfirmation - - var threadIdentifier: String { - "com.thump.alerts.\(rawValue)" - } - - /// Stable identifier — one per type, no UUID, so scheduling replaces - /// any existing pending notification of the same type (GPT-5.4 fix #2). - var notificationIdentifier: String { - "com.thump.\(rawValue)" - } - - /// Priority for daily budget arbitration (higher = more important). - var priority: Int { - switch self { - case .illnessDetection: return 100 - case .morningBriefing: return 90 - case .reboundConfirmation: return 80 - case .trainingOpportunity: return 70 - case .eveningRecovery: return 60 - case .bedtimeWindDown: return 50 - case .postWorkoutRecovery: return 40 - } - } -} - // MARK: - Configuration /// All thresholds in one testable struct — no magic numbers (Gemini design).