//
//  AddSupersetView.swift
//  Werkout_ios
//
//  Created by Trey Tartt on 12/18/24.
//
import SwiftUI

struct AddSupersetView: View {
    @Binding var createWorkoutSuperSet: CreateWorkoutSuperSet
    var viewModel: WorkoutViewModel
    @Binding var selectedCreateWorkoutSuperSet: CreateWorkoutSuperSet?
    
    var body: some View {
        TabView {
            ForEach(createWorkoutSuperSet.exercises, id: \.id) { createWorkoutExercise in
                VStack {
                    Text(createWorkoutExercise.exercise.name)
                        .font(.title2)
                        .frame(maxWidth: .infinity)
                    if createWorkoutExercise.exercise.side != nil && createWorkoutExercise.exercise.side!.count > 0 {
                        Text(createWorkoutExercise.exercise.side!)
                            .font(.title3)
                            .frame(maxWidth: .infinity, alignment: .center)
                    }
                    CreateExerciseActionsView(workoutExercise: createWorkoutExercise,
                                              superset: createWorkoutSuperSet,
                                              viewModel: viewModel)
                }
                .frame(width: 300.0)
                .padding(.bottom, 40)
            }
        }
        .frame(height: 300)
        .tabViewStyle(.page)
        .onAppear {
            setupAppearance()
        }
    }
    
    func setupAppearance() {
        UIPageControl.appearance().currentPageIndicatorTintColor = .black
        UIPageControl.appearance().pageIndicatorTintColor = UIColor.black.withAlphaComponent(0.2)
    }
}
