import Foundation
import SwiftData

@Model final class TypeCount {
    var id: UUID = UUID()
    var typeIdentifier: String = ""
    var displayName: String = ""
    var count: Int = 0
    var hash: String = ""
    var earliestDate: Date?
    var latestDate: Date?
    var quality: SnapshotQuality = SnapshotQuality.complete
    var isUnsupported: Bool = false
    var snapshot: HealthSnapshot?
    @Relationship(deleteRule: .cascade, inverse: \YearlyCount.typeCount)
    var yearlyCounts: [YearlyCount]? = []

    init(typeIdentifier: String, displayName: String, count: Int, quality: SnapshotQuality = .complete) {
        self.id = UUID()
        self.typeIdentifier = typeIdentifier
        self.displayName = displayName
        self.count = count
        self.quality = quality
    }
}
