import Foundation

enum AnomalyType: String, Codable {
    case historicalInsertion = "historical_insertion"
    case deletion            = "deletion"
    case duplication         = "duplication"
    case silentReplacement   = "silent_replacement"
    case syncAnomaly         = "sync_anomaly"
}

enum Severity: String, Codable, Comparable {
    case info, warning, critical

    private static let order: [Severity] = [.info, .warning, .critical]
    static func < (lhs: Severity, rhs: Severity) -> Bool {
        order.firstIndex(of: lhs)! < order.firstIndex(of: rhs)!
    }
}

enum TypeTransition: String, Codable {
    case unchanged    // type present in both, count and hash identical
    case changed      // type present in both, count or hash differs
    case appeared     // type missing in previous, present in current
    case disappeared  // type present in previous, missing in current
}

enum TypeDeltaReason: String, Codable {
    case normal               // expected delta, no external cause
    case registryChanged      // monitoredTypeSetHash changed between snapshots
    case authorizationChanged // type quality == .unauthorized
    case unsupported          // type unavailable on this OS/device
    case unknown
}
