//
//  MatchFormatSelectionView.swift
//  PadelClub
//
//  Created by Razmig Sarkissian on 22/03/2024.
//

import SwiftUI

struct MatchFormatSelectionView: View {
    @Environment(\.dismiss) private var dismiss
    @Binding var matchFormat: MatchFormat
    var additionalEstimationDuration: Int?

    var body: some View {
        List {
            Section {
                Picker(selection: $matchFormat) {
                    ForEach(MatchFormat.allCases) { format in
                        MatchFormatRowView(matchFormat: format, additionalEstimationDuration: additionalEstimationDuration).tag(format)
                    }
                } label: {
                    
                }
                .labelsHidden()
                .pickerStyle(.inline)
            }
        }
        .onChange(of: matchFormat) {
            dismiss()
        }
    }
}
