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

import SwiftUI
import LeStorage

struct TournamentInitView: View {
    var tournament: Tournament

    @ViewBuilder
    var body: some View {
        Section {
            
            if let event = tournament.eventObject() {
                let tournaments = event.tournaments
                NavigationLink(value: Screen.event) {
                    LabeledContent {
                        Text(tournaments.count.formatted() + " épreuve" + tournaments.count.pluralSuffix)
                    } label: {
                        Text("Gestion de l'événement")
                    }
                }
            }
            
            NavigationLink(value: Screen.structure) {
                LabeledContent {
                    Text(tournament.structureDescriptionLocalizedLabel())
                } label: {
                    LabelStructure()
                }
            }
            
            NavigationLink(value: Screen.settings) {
                LabeledContent {
                    Text(tournament.settingsDescriptionLocalizedLabel())
                } label: {
                    LabelSettings()
                }
            }
            
            TournamentBroadcastRowView(tournament: tournament)
            
            NavigationLink(value: Screen.print) {
                Text("Imprimer")
            }
        }
    }
}

//#Preview {
//    TournamentInitView(tournament: Tournament.mock())
//}
