//
//  TournamentBroadcastRowView.swift
//  PadelClub
//
//  Created by Razmig Sarkissian on 05/06/2024.
//

import SwiftUI
import LeStorage

struct TournamentBroadcastRowView: View {
    var tournament: Tournament

    var body: some View {
        NavigationLink(value: Screen.broadcast) {
            let club = tournament.eventObject()?.club
            LabeledContent {
                if StoreCenter.main.userId == nil || club == nil {
                    Image(systemName: "exclamationmark.circle.fill")
                        .foregroundStyle(.logoYellow)
                } else {
                    if tournament.isPrivate {
                        Text("tournoi privé").foregroundStyle(.logoRed)
                    } else {
                        Text("Automatique")
                    }
                }
            } label: {
                Text("Publication")
                if StoreCenter.main.userId == nil {
                    Text("Créez un compte pour publier !")
                } else if club == nil {
                    Text("Associez un club pour publier !")
                }
            }
        }
    }
}
