import Foundation
import HealthDB
import HealthKit

private let df: DateFormatter = {
    let df = DateFormatter()
    df.timeZone = .current
    df.dateStyle = .short
    df.timeStyle = .short
    return df
}()

extension Workout: @retroactive Identifiable {

    public var id: Int {
        dataId
    }
}

extension Workout {

    var workoutActivityType: HKWorkoutActivityType {
        workoutActivities.first!.workoutConfiguration.activityType
    }

    var typeString: String {
        workoutActivityType.description
    }

    var dateString: String {
        df.string(from: startDate)
    }
}
