import SwiftUI
import HealthKitExtensions
import HealthDB

struct QuantitySampleRow<T>: View where T: HKQuantitySampleContainer {

    let database: HealthDatabase

    let title: String?

    init(database: HealthDatabase, title: String? = nil) {
        self.database = database
        self.title = title
    }

    var body: some View {
        NavigationLink {
            QuantitySampleList<T>(database: database)
        } label: {
            Text(title ?? T.quantityTypeIdentifier.description)
        }
    }
}

#Preview {
    QuantitySampleRow<ActiveEnergyBurned>(database: .empty)
}
