//
//  NeighborsSelectionFooter.swift
//  AlloVoisinsSwiftUI
//
//  Created by Victor on 02/06/2025.
//

import SwiftUI

struct NeighborsSelectionFooter: View {
    var inProfile: Bool = true

    var body: some View {
        VStack(spacing: 0) {
            if inProfile {
                VStack {
                    HStack(alignment: .top) {
                        SQCircleButton(
                            SQIcon(.arrow_left, size: .l)
                        ) {}
                        Spacer()
                        VStack {
                            SQCircleButton(
                                SQIcon(.plus, size: .l),
                                color: .sqNeutral(),
                                size: .l,
                                isFull: false
                            ) {}
                            SQText("Sélectionner")
                                .sqFont(.semiBold)
                        }
                        Spacer()
                        SQCircleButton(
                            SQIcon(.arrow_right, size: .l)
                        ) {}
                    }

                    SQDivider()
                }
                .padding(.horizontal, 16)
                .padding(.vertical, 8)
                .background(
                    LinearGradient(
                        stops: [
                            Gradient.Stop(color: Color.sqNeutral(10).opacity(0), location: 0.00),
                            Gradient.Stop(color: Color.sqNeutral(10), location: 0.70),
                        ],
                        startPoint: UnitPoint(x: 0.5, y: 0),
                        endPoint: UnitPoint(x: 0.5, y: 1)
                    )
                )
            }

            VStack(alignment: .leading, spacing: 8) {
                SQText("Nous vous recommandons de sélectionner 3 offreurs :")
                    .sqSize(13)
                    .sqFont(.bold)
                VStack(alignment: .leading, spacing: 8) {
                    HStack(spacing: 8) {
                        SQImage("neighbor_avatar", height: 32)
                        SQImage("neighbor_avatar", height: 32)
                        SQImage("neighbor_avatar", height: 32)
                        MoreNeighborsSelectedBadge(selectedNeighbors: .constant(4))
                    }
                    HStack {
                        VStack(alignment: .leading) {
                            HStack {
                                SQText("0 offreur sélectionné")
                                Spacer()
                            }
                            HStack(spacing: 4) {
                                SQProgressIndicator(.constant(true))
                                SQProgressIndicator(.constant(true))
                                SQProgressIndicator(.constant(false))
                            }
                            .frame(maxWidth: .infinity)
                        }
                        Spacer()
                        SQButton("Continuer") {

                        }
                    }
                }
            }
            .padding()
            .background(Color.sqNeutral(10))
        }
    }
}

#Preview {
    NeighborsSelectionFooter()
}
