Cotton code
52 lines · 1.8 KB · SwiftRaw
// One device as the Your devices list and Home's devices fold hold it: a// value rather than the wire row, filled from `read.devices`.import CottonKitimport Foundation/// One device, as both the Your devices list and the sidebar line need it.////// A value rather than the wire row, so the derivation is testable without a/// core and so the `serving` fact can be filled from whatever answers it.public struct DeviceLine: Equatable, Sendable {    public let id: String    public let name: String    /// The wire's enum — `"ios"`, `"mac"`, `"android"`.    public let platform: String?    public let appVersion: String?    /// The registry's stamp — `nil` off the file. See the file header.    public let lastSeenAt: String?    /// The Mac's own reading (`sampledAt`), off the file. See the file header.    public let reportedAt: String?    /// When the device was let in — the one stamp every row has.    public let approvedAt: String?    public let revokedAt: String?    public let isThisDevice: Bool    /// `nil` until the server says. See the file header.    public let serving: Bool?    public init(        id: String,        name: String,        platform: String? = nil,        appVersion: String? = nil,        lastSeenAt: String? = nil,        reportedAt: String? = nil,        approvedAt: String? = nil,        revokedAt: String? = nil,        isThisDevice: Bool = false,        serving: Bool? = nil    ) {        self.id = id        self.name = name        self.platform = platform        self.appVersion = appVersion        self.lastSeenAt = lastSeenAt        self.reportedAt = reportedAt        self.approvedAt = approvedAt        self.revokedAt = revokedAt        self.isThisDevice = isThisDevice        self.serving = serving    }}