@Observable class ApplicationData {
   @ObservationIgnored let center = UNUserNotificationCenter.current()
   @ObservationIgnored let centerDelegate: CenterDelegate = CenterDelegate()

   static let shared: ApplicationData = ApplicationData()
   private init() {
      center.delegate = centerDelegate
   }
   func askAuthorization() async -> Bool {
      do {
         let authorized = try await center.requestAuthorization(options: [.alert, .sound])
         return authorized
      } catch {
         print("Error: \(error)")
         return false
      }
   }
   func postNotification(message: String) async {
      let content = UNMutableNotificationContent()
      content.title = "Reminder"
      content.body = message

      let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 10, repeats: false)
      let id = "reminder-\(UUID())"
      let request = UNNotificationRequest(identifier: id, content: content, trigger: trigger)
      do {
         let center = UNUserNotificationCenter.current()
         try await center.add(request)
      } catch {
         print("Error: \(error)")
      }
   }
}