import Foundation /// One issue; `issue list` rows and the header of `issue show`. nonisolated struct Issue: Decodable, Sendable, Hashable, Identifiable { let number: Int64 let title: String let state: String let author: String let milestone: String? let labels: [String]? let assignees: [String]? let body: String? let createdAt: Date enum CodingKeys: String, CodingKey { case number, title, state, author, milestone, labels, assignees, body case createdAt = "created_at" } var id: Int64 { number } var isOpen: Bool { state == "open" } } /// `issue show ` — the issue plus its comments. nonisolated struct IssueDetail: Decodable, Sendable, Hashable { let number: Int64 let title: String let state: String let author: String let milestone: String? let labels: [String]? let assignees: [String]? let body: String? let createdAt: Date let comments: [Comment]? enum CodingKeys: String, CodingKey { case number, title, state, author, milestone, labels, assignees, body, comments case createdAt = "created_at" } var isOpen: Bool { state == "open" } nonisolated struct Comment: Decodable, Sendable, Hashable, Identifiable { let author: String let body: String let createdAt: Date enum CodingKeys: String, CodingKey { case author, body case createdAt = "created_at" } var id: String { author + createdAt.timeIntervalSince1970.description + body } } }