//
//  WebinaireScreen.swift
//  Sequoia
//
//  Created by Victor on 09/10/2024.
//

import SwiftUI

struct WebinaireScreen: View {
    @ObservedObject var viewModel: PromotionalScreenViewModel
    @State private var navigateToNext = false

    var body: some View {
        VStack(spacing: 16) {
            VStack(spacing: 32) {
                SQText("Webinaire spécial Pro")
                    .sqSize(20)
                    .sqFont(.bold)
                    .multilineTextAlignment(.center)
                Image("webinaire")
                    .resizable()
                    .scaledToFit()
                    .frame(height: 140)
                SQText("30 minutes")
                    .sqSize(32)
                    .sqFont(.bold)
                VStack {
                    SQText("Inscrivez-vous dès maintenant au webinaire gratuit sur le thème")
                        .multilineTextAlignment(.center)
                    SQText("“Augmenter mon chiffre d'affaires.“")
                        .sqSize(18)
                        .sqFont(.bold)
                }
                NavigationLink {
                    if let screen = viewModel.nextPromotionalScreen {
                        viewModel.getPromotionalScreenNew(for: screen)
                    } else {
                        ResiliationConfirmationScreen()
                    }
                } label: {
                    SQButton("Je m’inscris") {
                    }
                    .sqColorScheme(.grape)
                }
            }
            .padding(16)
            .background(Color.sqGrape(10))
            .cornerRadius(8)

            NavigationLink {
                if let screen = viewModel.nextPromotionalScreen {
                    viewModel.getPromotionalScreenNew(for: screen)
                } else {
                    ResiliationConfirmationScreen()
                }
            } label: {
                SQButton("Non merci, je souhaite résilier") {
                }
                .sqButtonType(.glass)
                .sqTextSize(13)
            }
        }
        .navigationDestination(isPresented: $navigateToNext) {
            if let screen = viewModel.nextPromotionalScreen {
                viewModel.getPromotionalScreenNew(for: screen)
            } else {
                ResiliationConfirmationScreen()
            }
        }
        .sqNavigationBar(title: "Ne partez pas !")
    }
}

#Preview {
    WebinaireScreen(viewModel: PromotionalScreenViewModel())
}
