// A DOOR THAT READS THE DEVICE (`create.doors[].reads`; Cotton Health, 13 Nov// 2026): Read Apple Health. What the door reads is the flavour's own, linked// only by the app that reads it (Cotton Health links HealthKit, no other app// does), so the shell names the act and the app attaches the reader at// launch (`CottonHealthKit`'s `HealthEngine`). A tap asks the system then and// there, through `SystemCapabilityAuthority`, and never before: an app that// asked at launch would ask a person who has not yet said what they came for.importCottonKitimportSwiftUI/// What a reading door reads, attached by the app that links it.publicprotocolDeviceReading: Sendable {/// Read `reads` into the database the core has open and say how it went.func read(_ reads: DefinitionDeviceReads, core: any CottonCalling) async -> DeviceReadSaid}/// A reading door's one line: what came in, or why nothing did.publicstructDeviceReadSaid: Equatable, Sendable {publiclet line: Stringpubliclet failed: Boolpublicinit(line: String, failed: Bool) {self.line = lineself.failed = failed }}/// The reader this app attached, if it reads anything.@MainActorpublicenumDeviceReadings {publicstaticvar reader: (any DeviceReading)?/// The door's tap: the attached reader reads and its line is said.staticfunc read(_ reads: DefinitionDeviceReads, core: (any CottonCalling)?, toasts: ToastCenter?) async {guardlet reader, let core else { toasts?.show(ShellLines.line("cards", "health.read.unavailable"), tone: .error)return }let said = await reader.read(reads, core: core) toasts?.show(said.line, tone: said.failed ? .error : .success) }}