import Foundation /// The `dashboard` command: the whole account aggregate in one read. /// `internal/control/dashboard.go` — arrays are always present. nonisolated struct DashboardData: Decodable, Sendable, Hashable { /// Pinned repos share `repo list`'s row shape. let pinned: [RepoSummary] let openMRs: [DashboardItem] let assignedIssues: [DashboardItem] let builds: [DashboardBuild] enum CodingKeys: String, CodingKey { case pinned, builds case openMRs = "open_mrs" case assignedIssues = "assigned_issues" } } /// One open issue or MR row, repo resolved server-side. nonisolated struct DashboardItem: Decodable, Sendable, Hashable, Identifiable { let repo: String let number: Int64 let title: String let author: String let state: String let updatedAt: Date enum CodingKeys: String, CodingKey { case repo, number, title, author, state case updatedAt = "updated_at" } var id: String { "\(repo)#\(number)" } } /// One build row with its repo attached. nonisolated struct DashboardBuild: Decodable, Sendable, Hashable, Identifiable { let repo: String let number: Int64 let job: String let status: String let sha: String let ref: String let createdAt: Date let finishedAt: Date? enum CodingKeys: String, CodingKey { case repo, number, job, status, sha, ref case createdAt = "created_at" case finishedAt = "finished_at" } var id: String { "\(repo)#\(number)" } }