//
//  CreateWorkoutSupersetActionsView.swift
//  Werkout_ios
//
//  Created by Trey Tartt on 6/18/23.
//

import SwiftUI

struct CreateWorkoutSupersetActionsView: View {
    var workoutSuperSet: CreateWorkoutSuperSet
    @Binding var showAddExercise: Bool
    var viewModel: WorkoutViewModel
    @Binding var selectedCreateWorkoutSuperSet: CreateWorkoutSuperSet?
    
    var body: some View {
        HStack {
            Button(action: {
                selectedCreateWorkoutSuperSet = workoutSuperSet
                showAddExercise.toggle()
            }) {
                Text("Add exercise")
                    .padding()
            }
            .foregroundColor(.white)
            .background(.green)
            .cornerRadius(10)
            .frame(maxWidth: .infinity, alignment: .center)
            .buttonStyle(BorderlessButtonStyle())
            
            Button(action: {
                viewModel.delete(superset: workoutSuperSet)
                viewModel.increaseRandomNumberForUpdating()
                viewModel.objectWillChange.send()
                
            }) {
                Text("Delete superset")
                    .padding()
            }
            .foregroundColor(.white)
            .background(.red)
            .cornerRadius(10)
            .frame(maxWidth: .infinity, alignment: .center)
            .buttonStyle(BorderlessButtonStyle())
        }
    }
}

//struct CreateWorkoutSupersetActionsView_Previews: PreviewProvider {
//    static var previews: some View {
//        CreateWorkoutSupersetActionsView()
//    }
//}
