// A row in one of the three feeds that read across databases.//// Only Today, search and "Asked of you" answer across the databases this// device holds (owner decision 3 Oct 2026, Cotton note 0a22168c); every other// read is the shown database's. A row in one of them says which database it// came from — `databaseId` and `databaseName` beside its own fields — and one// id in two databases is two rows, never one.//// A row with no database is what every read answers today, and it keeps the// identity and the request it always had: with one database held nothing// here changes a byte. The core's reads pick their arguments by name and// ignore the rest (`cotton-ffi/src/phone/mod.rs::read_args`), so `database`// is only sent when there is more than one database to read.importFoundation/// The database a feed row came from.publicstructFeedRowDatabase: Equatable, Hashable, Sendable {publiclet databaseId: String/// The name the row's database had when the row was read; empty when the/// row named only the id.publiclet databaseName: String/// Nil when there is no id: a row with no database is not in one of/// several.publicinit?(databaseId: String?, databaseName: String? = nil) {guardlet databaseId, !databaseId.trimmingCharacters(in: .whitespaces).isEmpty else { returnnil }self.databaseId = databaseIdself.databaseName = databaseName ?? "" }/// The row's `databaseId` and `databaseName`, or nil when it names none.publicinit?(_ row: JSONValue) {self.init(databaseId: row["databaseId"]?.string, databaseName: row["databaseName"]?.string) }/// The key a feed lists a row under: the row's own key with no database,/// and the database's id before it with one — so one id in two databases/// is two rows, and a row with none keeps the key it always had.publicstaticfunc key(_ database: FeedRowDatabase?, id: String) -> String {guardlet database else { return id }return"\(database.databaseId)/\(id)" }/// What a feed's request names to read every held database.publicstaticlet all = "all"/// `database` for a feed's request: `"all"` when this device holds more/// than one database, nil — no key, the request as it always was — with/// one or none.publicstaticfunc scope(holding count: Int) -> String? { count > 1 ? all : nil }/// The link a row's tap opens: its route, in its own database.publicstaticfunc link(_ database: FeedRowDatabase?, route: Route) -> DatabaseLink {DatabaseLink(database: database?.databaseId, route: route) }}