importFoundation/// The core's `status` answer: what the popover draws.structCoreStatus: Decodable, Sendable, Equatable {var signedIn: Boolvar signedOut: Boolvar host: String?var phone: String?var lastPushAt: String?var sources: [SourceStatus]/// This Mac's vault key, once a pass has looked: none before the first.var vault: VaultLine?/// Why this Mac was signed out, for the sign-in screen: the core's words.var signInNote: String?/// The words of the button that asks a signed-in phone to approve this Mac.var askButton: String?/// The panel as the person sees it, decided by the core (`crates/cotton-mac/src/panel.rs`).var panel: Panel?structPanel: Decodable, Sendable, Equatable {/// signIn | step | workingvar screen: Stringvar heading: String?var line: String?var headline: Headline?var rows: [Row]?var account: Account/// The source pages' words, as the lines hold them (`{address}` and the like filled here).var page: [String: String]?structHeadline: Decodable, Sendable, Equatable {var line: Stringvar sub: String?var needs: Boolvar progress: Fraction? }structFraction: Decodable, Sendable, Equatable {var done: Intvar total: Int }structRow: Decodable, Sendable, Equatable, Identifiable {var source: Stringvar title: String/// ok | bringing | paused | problem | add | unavailablevar kind: Stringvar line: Stringvar act: String?var paused: Bool/// Bring everything in again is asked or under way: the page says so until that run ends.var again: Bool?/// Mail's walk through the whole mailbox, while it goes on: "Older mail: back to March 2015 · 41,200 of 98,000".var history: String?var id: String { source } }structAccount: Decodable, Sendable, Equatable {var who: String?var signOut: Stringvar updates: Stringvar quit: Stringvar quitLine: String?var quitAnyway: String?var cancel: String?var launchLine: String? }func word(_ key: String, _ fills: [String: String] = [:]) -> String {var said = page?[key] ?? ""for (name, value) in fills { said = said.replacingOccurrences(of: "{\(name)}", with: value) }return said } }structVaultLine: Decodable, Sendable, Equatable {/// waiting (published, not approved yet) | open | troublevar state: String/// What the phone's Keys › Devices shows for this Mac, to match by eye.var fingerprint: String?/// The core's one sentence.var detail: String/// While not let in: the button that asks a signed-in phone, right here.var ask: String?/// While not let in: the button that signs this Mac out.var signOut: String? }}structSourceStatus: Decodable, Sendable, Equatable {var source: Stringvar schedule: String/// idle | running | paused | needs | errorvar phase: Stringvar probe: Probevar progress: Progress?var lastBrought: Intvar lastBroughtAt: String?var lastRunAt: String?var total: Intvar error: String?structProbe: Decodable, Sendable, Equatable {var ready: Boolvar need: Need?var detail: String? }structNeed: Decodable, Sendable, Equatable {/// fullDiskAccess | pair | credentialsvar kind: String/// pair: the pairing under way, "code" or "qr"; none until one is picked.var by: String?var code: String?var qr: String?/// pair: WhatsApp's passkey step once it asks for one — asking (in/// Chrome), retry, sent, confirm, linking.var passkey: String?/// pair, passkey "confirm": the code the phone shows too.var confirm: String? }structProgress: Decodable, Sendable, Equatable {var sent: Intvar uploaded: Intvar total: Int? }}/// The five sources, in row order.enumSource: String, CaseIterable, Sendable, Identifiable {case whatsapp, mail, photos, calls, textsvar id: String { rawValue }var title: String {switchself {case .whatsapp: "WhatsApp"case .mail: "Mail"case .photos: "Photos"case .calls: "Calls"case .texts: "Texts" } }/// What one row this source brings is called, singular and plural.var noun: (one: String, many: String) {switchself {case .whatsapp: ("message", "messages")case .mail: ("email", "emails")case .photos: ("photo", "photos")case .calls: ("call", "calls")case .texts: ("text", "texts") } }/// What the files a run puts are called.var fileNoun: (one: String, many: String) {switchself {case .whatsapp: ("picture", "pictures")case .photos: ("file", "files")case .mail, .calls: ("file", "files")case .texts: ("picture", "pictures") } }/// Whether the source keeps Mail-style credentials in the keychain.var takesCredentials: Bool { self == .mail }}