//
//  GameParametersMenuView.swift
//  ArkitDoushiQi
//
//  Created by Johan LACHENAL on 24/05/2024.
//

import SwiftUI
import PhotosUI

enum AIT: String, CaseIterable, Identifiable, Hashable {
    case RandomAction = "IA Random"
    case EasyTrainedAI = "IA Facile"
    case MediumTrainedAI = "IA Intermédiaire"
    
    var id: String { self.rawValue }
}

enum Rules: String, CaseIterable, Identifiable, Hashable {
    case Easy = "Simplifié"
    case Regular = "Normal"
    var id: String { self.rawValue }
}

struct GameParametersMenuView: View {
    @State private var selectedAIOption: AIT = .RandomAction
    @State private var selectedRulesOption: Rules = .Regular
    var body: some View {
        NavigationView {
            VStack(alignment: .leading) {
                HStack(alignment: .center) {
                    Text("Paramètres de partie").bold().font(.title)
                }.frame(maxWidth: .infinity)
                PickerComponent(title: "Sélectionne les règles :",
                                selectedOption: $selectedRulesOption,
                                options: Rules.allCases)
                PickerComponent(title: "Sélectionne une IA :",
                                selectedOption: $selectedAIOption,
                                options: AIT.allCases)
                EditComponent(explanation: "Nom du joueur 1", value: "Joueur 1")
                EditComponent(explanation: "Nom du joueur 2",value: "Joueur 2")
                ButtonComponent(title: "Lancer la partie") {
                    GameView()
                }.padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32))
            }
            .frame(maxHeight: .infinity, alignment: .top)
        }
    }

}

struct GameParametersMenuView_Previews: PreviewProvider {
    static var previews: some View {
        GameParametersMenuView()
    }
}
