//
//  BoosterSelectionView.swift
//
//
//  Created by Victor on 12/06/2024.
//

import SwiftUI

struct BoosterSelectionView: View {
    @State var selectedId: Int = 1
    var isAppleSubscription: Bool = false
    var oneMonthFree: Bool = true
    
    var body: some View {
        VStack(spacing: 16) {
            HStack(alignment: .top, spacing: 0) {
                if isAppleSubscription {
                    BoosterSubscriptionCardView(id: 1, selectedId: .constant(1))
                } else {
                    ForEach(0...2, id: \.self) { index in
                        BoosterSubscriptionCardView(id: index, selectedId: $selectedId, isFree: index == 1)
                            .onTapGesture {
                                selectedId = index
                            }
                    }
                }
            }
            SQText("* 1 mois gratuit valable uniquement sur la formule “3 jours par semaine.”", size: 14)
                .multilineTextAlignment(.center)
                .foregroundColor(.sqRoyal())
        }
    }
}

#Preview {
    ZStack {
        BoosterSelectionView(oneMonthFree: true)
            .padding()
    }
    .ignoresSafeArea()
}
