importCottonValuesimportFoundation/// This phone met a Cotton push: the receipt `device.pushAck` carries to the/// serving Mac.////// A push counts as reaching the owner when the PHONE says it showed it, not/// when Apple answers 2xx (architect, 12 Oct 2026): two Test pushes Apple/// took on 12 Oct never showed, because iOS had never been asked for/// notifications on that install and dropped every alert. The receipt is/// what the first-push stamp and Test push's "Arrived" stand on.publicstructPushReceipt: Encodable, Sendable, Equatable {/// The push's own id — the payload's `notificationId`, the `_push_log`/// row the server sent it from and the `apns-id` Apple traces it by.publiclet pushId: String/// When iOS delivered it, ISO-8601 UTC (`UNNotification.date`).publiclet receivedAt: String/// How the phone met it.publiclet how: HowpublicenumHow: String, Encodable, Sendable {/// Presented while the app was open (`willPresent`).case shown/// Found in Notification Centre at a foreground — iOS showed it while/// the app was away.case delivered/// The person tapped it (`didReceive`).case opened }publicinit(pushId: String, receivedAt: String, how: How) {self.pushId = pushIdself.receivedAt = receivedAtself.how = how }/// The receipt of a notification, or nil for one that is not a server/// push — a local reminder carries no `notificationId`, and nothing/// is owed for it.publicstaticfunc of(userInfo: JSONValue, date: Date, how: How) -> PushReceipt? {guardlet id = NotificationRoutes.stringParam(NotificationTaps.payload(of: userInfo), "notificationId") else {returnnil }returnPushReceipt(pushId: id, receivedAt: CottonDate.format(date), how: how) }}