1import Foundation
2
3/// Every file of a run that has no coverage: the page, `totals.json` and the stylesheet.
4/// Values only; writing them is the command's job.
5public struct UnavailableSite: Sendable {
6 public let files: [CoverageSite.File]
7
8 /// - Parameter date: when the run was built; recorded in `totals.json`.
9 public init(
10 title: String, reason: String, commit: String?, subject: String?, date: Date
112 ) throws {
122 let page = UnavailablePage(title: title, reason: reason, commit: commit, subject: subject)
132 let totals = RunTotals(
142 unavailableBecause: reason, commit: commit, subject: subject, date: date)
152 files = [
162 CoverageSite.File(path: UnavailablePage.sitePath, contents: page.html),
172 CoverageSite.File(
182 path: RunTotals.fileName,
192 contents: String(decoding: try totals.json(), as: UTF8.self)),
202 CoverageSite.File(path: SiteStylesheet.fileName, contents: SiteStylesheet.contents),
212 ]
222 }
23}