//
//  LoginAndPasswordView.swift
//  AlloVoisinsSwiftUI
//
//  Created by Victor on 21/10/2025.
//

import SwiftUI

struct LoginAndPasswordView: View {
    @State var email: String = ""
    @State var phone: String = ""
    @State var currentPassword: String = ""
    @State var newPassword: String = ""
    @State var newPasswordRepeat: String = ""

    var body: some View {
        ScrollView {
            VStack(spacing: 0) {
                VStack(alignment: .leading, spacing: 16) {
                    VStack(alignment: .leading, spacing: 8) {
                        SQText("Identifiants")
                            .sqSize(18)
                            .sqFont(.bold)
                        SQText("Vos identifiants ne sont pas communiqués aux autres membres.")
                            .sqFont(.semiBold)
                    }
                    VStack(spacing: 4) {
                        SQTextField("Adresse e-mail", text: $email)
                            .sqPlaceholder("pie**@d**********.com")
                            .sqDisabled(true)
                        HStack {
                            Spacer()
                            Button {

                            } label: {
                                SQText("Modifier")
                                    .sqSize(13)
                                    .underline()
                            }
                        }
                    }
                    VStack(spacing: 4) {
                        SQTextField("Numéro de téléphone", text: $phone)
                            .sqPlaceholder("06******09")
                            .sqDisabled(true)
                        HStack {
                            Spacer()
                            Button {

                            } label: {
                                SQText("Modifier")
                                    .sqSize(13)
                                    .underline()
                            }
                        }
                    }
                }
                .padding(.horizontal)
                .padding(.bottom, 16)

                Rectangle()
                    .frame(height: 16)
                    .foregroundColor(Color.sqNeutral(10))

                VStack(alignment: .center, spacing: 16) {
                    VStack(alignment: .leading, spacing: 16) {
                        SQText("Modifier mon mot de passe")
                            .sqSize(18)
                            .sqFont(.bold)

                        SQPasswordField("Mot de passe actuel", text: $currentPassword)
                            .sqPlaceholder("*********")
                        SQPasswordField("Nouveau mot de passe", text: $newPassword)
                            .sqPlaceholder("*********")
                        PasswordRecommendations()
                        SQPasswordField("Confirmez votre mot de passe", text: $newPasswordRepeat)
                            .sqPlaceholder("*********")
                    }

                    VStack(alignment: .center, spacing: 16) {
                        SQButton("Modifier mon mot de passe") {

                        }
                        .sqButtonType(.line)

                        Button {

                        } label: {
                            SQText("Mot de passe oublié")
                                .sqSize(13)
                                .sqFont(.semiBold)
                                .underline()
                        }
                    }
                    .padding(.top, 16)
                    .padding(.horizontal)
                }
                .padding()
            }
        }
        .sqNavigationBar(title: "Identifiants et mot de passe")
    }
}

#Preview {
    LoginAndPasswordView()
}
