//
//  ConfigPrestationSearchView.swift
//  AlloVoisinsSwiftUI
//
//  Created by Victor on 20/01/2025.
//

import SwiftUI

struct ConfigPrestationSearchView: View {
    @State var showSearchView: Bool = false
    @State var showSuggested: Bool = false
    @State var showAllCategories: Bool = false

    @State var selectedSearchType: PickerOption = .init(text: "Prestations")
    @State var searchTypes: [PickerOption] = [
        PickerOption(text: "Prestations"),
        PickerOption(text: "Prestation Catégories"),
        PickerOption(text: "Prestations + Prestation Catégories")
    ]

    var body: some View {
        VStack {
            Spacer()
            VStack(spacing: 16) {
                SQText("Configuration de la recherche des prestations")
                    .sqSize(18)
                    .sqFont(.bold)
                    .multilineTextAlignment(.center)
                Divider()
                SQText("Types à rechercher :")
                    .sqFont(.semiBold)
                SQPicker(selection: $selectedSearchType, options: searchTypes)
                Toggle(isOn: $showSuggested) {
                    SQText("Afficher une suggestion")
                        .sqFont(.semiBold)
                }
                Toggle(isOn: $showAllCategories) {
                    SQText("Afficher \"Toutes les catégories\"")
                        .sqFont(.semiBold)
                }
            }
            .padding()
            .background {
                RoundedRectangle(cornerRadius: 10)
                    .fill(Color.sqNeutral(10))
            }
            .padding(.horizontal)
            Spacer()
            SQFooter {
                SQButton("Afficher la vue") {
                    showSearchView.toggle()
                }
            }
            .sheet(isPresented: $showSearchView) {}
        }
        .ignoresSafeArea(.container, edges: .bottom)
    }
}

#Preview {
    ConfigPrestationSearchView()
}
