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

import SwiftUI

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

    var body: some View {
        VStack(spacing: 16) {
            VStack(spacing: 32) {
                SQText("Vous n’obtenez pas de réponses positives car votre profil est incomplet.")
                    .sqSize(20)
                    .sqFont(.bold)
                    .multilineTextAlignment(.center)
                VStack(spacing: 8) {
                    HStack(spacing: 4) {
                        SQIcon(.circle_exclamation, type: .solid, color: .sqSemanticNegative)
                        SQText("Profil complété à :")
                        SQText("40%")
                            .sqSize(18)
                            .sqFont(.bold)
                    }
                    VStack {
                        Rectangle()
                        .foregroundColor(.clear)
                        .frame(width: 123, height: 12)
                        .background(Color.sqNeutral(60))
                        .cornerRadius(50)
                    }
                    .frame(maxWidth: .infinity, alignment: .topLeading)
                    .background(Color.sqNeutral(20))
                    .cornerRadius(12)
                    HStack {
                        SQText("0%")
                            .sqSize(13)
                        Spacer()
                        SQText("100%")
                            .sqSize(13)
                    }
                    VStack(spacing: 8) {
                        SQText("Attractivité de votre profil :")
                        HStack(spacing: 16) {
                            SQText("Faible")
                                .sqSize(18)
                                .sqFont(.bold)
                            SQIcon(.chevron_right)
                            SQText("Modérée")
                                .sqSize(18)
                                .sqFont(.bold)
                                .sqColor(.sqNeutral(30))
                            SQIcon(.chevron_right)
                            SQText("Élevée")
                                .sqSize(18)
                                .sqFont(.bold)
                                .sqColor(.sqNeutral(30))
                        }
                    }
                }
                .padding(16)
                .background(Color.white)
                .cornerRadius(8)
                SQText("90%")
                    .sqSize(32)
                    .sqFont(.bold)
                SQText("des demandeurs comparent systématiquement les profils des offreurs  pour faire leur choix.")
                    .multilineTextAlignment(.center)
                SQButton("Je complète mon profil") {
                    navigateToNext = true
                }
            }
            .padding(16)
            .background(Color.sqNeutral(10))
            .cornerRadius(8)

            SQButton("J’ai compris, mais je souhaite résilier") {
                navigateToNext = true
            }
            .sqButtonType(.glass)
            .sqTextSize(13)
        }
        .navigationDestination(isPresented: $navigateToNext) {
            if let screen = viewModel.nextPromotionalScreen {
                viewModel.getPromotionalScreenNew(for: screen)
            } else {
                ResiliationConfirmationScreen()
            }
        }
        .sqNavigationBar(title: "Ne partez pas !")
        .padding()
    }
}

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