// A screen's BOARD (design note 26203e21 §4): the parts Home, the Tools// screen and the database page draw, in order, from a CLOSED set. The board// is a synced row (`cotton_board_definitions`) the core answers through// `definitions.board` — a person's own row, or this build's shipped default —// so a layout change is a database change, never a build.//// The app reads no part of a board's format: the core resolves every setting// (`board::default_of`) and answers what each part draws// (`shell.today`'s `parts.board`, `BoardEntry`). A kind the core does not know// answers `unknown` and is passed over, never a blank screen and never a refusal.importCottonValuesimportFoundationimportCottonKitpublictypealiasBoardDefinition = DefinitionBoardDefinitionextensionDefinitionBoardDefinition {publicinit(id: String, parts: [BoardPart]) {self.init(_generated: (), id: id, parts: parts) }}publictypealiasBoardVariant = DefinitionBoardVariant/// One part of a board, as stored: its kind and its settings. What a part/// DRAWS is the core's answer (`shell.today`'s `parts.board`, `BoardEntry`).publictypealiasBoardPart = DefinitionBoardPart/// Which of a table's rows a `list` part keeps: those whose columns hold/// `filter` (`records.list`'s `where`), kept by the table's own date to/// `period` (`this_month`, `today`, `next_7_days`). Empty keeps every row.publicstructBoardRowKeep: Hashable, Sendable {publicvar filter: [String: RecordValue]publicvar period: String?publicinit(filter: [String: RecordValue] = [:], period: String? = nil) {self.filter = filterself.period = period }publicvar keepsAll: Bool { filter.isEmpty && period == nil }}/// How the `tools` part lays out the tiles: a sideways row or a grid. Home/// draws its tiles as the grid whatever the part says: on the phone the fan/// under it is the frame's (`FanSurface.swift`), never the board's.publicenumBoardToolsFace: String, Sendable { case row, grid }/// The notices a `notices` part can show — the closed set the app draws,/// each once (`BoardNotices`). The crate holds the same words/// (`cotton_core::definitions::board::NOTICE_KINDS`).publicenumBoardNoticeKind: String, CaseIterable, Sendable {/// This build is older than the database needs.case update/// A held database's copy still arriving.case arriving/// A held database this device cannot read.case unreadable/// The off-Mac backup has stopped.case backup/// A device asking to join.case joinRequests/// What an assistant is working on.case workingOn/// The last read of the database was refused.case readRefusal/// A Mac that cannot be reached.case attention/// The chosen project's own page.case project}publicenumBoardToolsSize: String, Sendable { case large, small }// ── This build's own boards ──────────────────────────────────────────────//// What a screen draws while its row is read, and when the read fails: the// boards the crate ships (`crates/cotton-core/kits/shell/boards/<id>.json`),// as the core decoded them (`DefinitionCatalogue`) — never a Swift copy of a// board, and never this app's own read of the file.extensionBoardDefinition {/// Every board this build ships, as the core handed them over.publicstaticvar shippedBoards: [BoardDefinition] { DefinitionCatalogue.shippedBoards.values.sorted { $0.id < $1.id } }/// Home: the head with its cap and its two tags, the notices, and the/// tools in the person's arrangement.publicstaticvar home: BoardDefinition { shipped("home") }/// The Tools screen: every tool as a tile, and About at the foot.publicstaticvar tools: BoardDefinition { shipped("tools") }/// The database page is Home, one database at a time.publicstaticvar database: BoardDefinition { shipped("database") }/// This build's own board for the screen `id`; Home's for an id it ships none for./// A build whose core handed over no board at all draws an empty one —/// the open screen has already said why (`DefinitionCatalogue.receiveLastResort`).publicstaticfunc shipped(_ id: String) -> BoardDefinition {let boards = shippedBoardsreturn boards.first { $0.id == id } ?? boards.first { $0.id == "home" } ?? BoardDefinition(id: id, parts: []) }}