import CottonValues /// A plus card before its title creates the row, kept by the core under its /// `id` (`shell.draft`), which stages every choice made on it until its one /// create lands; `record` is the draft's values, then the record made. struct DeckDraft { /// The core's draft id: what a choice is staged under, made or not. let id: String let definition: TableDefinition var record: TableRecord var isNew = true /// The card the core resolved from the draft's values (`shell.draft`): /// its day in words, its time once one is set. Nil until it answers. var said: DeckCard? /// While new, the core's draft card; once made, the record's own card /// (`@card`, read back after the create and after each write), so the /// plus card left open on its acts wears its title and every change made /// there, never the empty card of before its title (Rigby 11 walk, 8 Nov /// 2026: a new todo stood as a blank strip until its acts closed). var card: DeckCard { if isNew, let said { return said } if let resolved = DeckCard(record) { return resolved } if let said { return said } // Until the core says the card, it holds the words typed alone: a // stored date or time is never drawn as stored ("2026-11-06"). var fields: [String: RecordValue] = [:] for field in definition.card?.fields ?? [] { guard let key = field.column, let column = definition.column(key), column.type != .date, column.type != .time else { continue } fields[field.slot.rawValue] = record[key] } return DeckCard(face: definition.card?.face.rawValue ?? DefinitionCardKind.plain.rawValue, corner: nil, pressing: false, pace: nil, plate: nil, fields: fields) } }