
struct PageIssue {

    let page: Page

    let language: ContentLanguage

    let message: GenerationAnomaly

    init(page: Page, language: ContentLanguage, message: GenerationAnomaly) {
        self.page = page
        self.language = language
        self.message = message

        print("\(title) (\(language)): \(message)")
    }

    var title: String {
        page.localized(in: language).title
    }
}

extension PageIssue: Identifiable {

    var id: String {
        page.id + "-" + language.rawValue + "-" + message.id
    }
}

extension PageIssue: Equatable {

    static func == (lhs: PageIssue, rhs: PageIssue) -> Bool {
        lhs.id == rhs.id
    }
}

extension PageIssue: Hashable {

    func hash(into hasher: inout Hasher) {
        hasher.combine(id)
    }
}

extension PageIssue: Comparable {

    static func < (lhs: PageIssue, rhs: PageIssue) -> Bool {
        lhs.id < rhs.id
    }
}
