//
//  SubscriptionsPricingView.swift
//  AlloVoisinsSwiftUI
//
//  Created by Victor on 21/01/2025.
//

import SwiftUI

struct SubscriptionsPricingView: View {
    @State var pricing: Pricing

    var body: some View {
        VStack(alignment: .leading, spacing: 0) {
            PricingSubscribeHeader(pricing: pricing)
            Divider()
            ScrollView {
                SwitchAndInfo(pricing: $pricing)
                Divider()

                VStack(spacing: 0) {
                    ForEach(pricing.featureSections, id: \.title) { section in
                        FeatureSection(section: section)
                    }
                }

                if pricing != .standard {
                    Divider()
                    ReassuranceIndicatorsRow(indicators: pricing.reassuranceIndicators)
                        .padding()
                    Divider()
                    FAQSection(items: pricing.faqItems)
                }
            }

            PricingSubscribeFooter(pricing: pricing)
        }
        .ignoresSafeArea(.container, edges: .bottom)
    }
}

#Preview {
    Color.white
        .sheet(isPresented: .constant(true)) {
            SubscriptionsPricingView(pricing: .premierPro)
        }
}
