//
//  CaloriesBurnedView.swift
//  Werkout_ios
//
//  Created by Trey Tartt on 6/18/24.
//

import SwiftUI

struct CaloriesBurnedView: View {
    @Binding var healthKitWorkoutData: HealthKitWorkoutData?
    let calsBurned: Double
    
    var body: some View {
        VStack {
            HStack {
                HStack {
                    Image(systemName: "flame.fill")
                        .foregroundColor(.orange)
                        .font(.title)
                    VStack {
                        Text("\(calsBurned, specifier: "%.0f")")
                    }
                }
                .frame(maxWidth: .infinity)
            }
            
            if let minHeart = healthKitWorkoutData?.minHeartRate,
               let maxHeart = healthKitWorkoutData?.maxHeartRate,
               let avgHeart = healthKitWorkoutData?.avgHeartRate {
                VStack {
                    HStack {
                        Image(systemName: "heart")
                            .foregroundColor(.red)
                            .font(.title)
                        VStack {
                            HStack {
                                Text("\(minHeart, specifier: "%.0f")")
                                Text("-")
                                Text("\(maxHeart, specifier: "%.0f")")
                            }
                            Text("\(avgHeart, specifier: "%.0f")")
                        }
                    }
                }
                .frame(maxWidth: .infinity)
            }
        }
    }
}

//#Preview {
//    CaloriesBurnedView()
//}
