//
//  MatchViewStyle.swift
//  PadelClub
//
//  Created by razmig on 17/11/2024.
//

import SwiftUI

enum MatchViewStyle {
    case standardStyle // vue normal
    case sectionedStandardStyle // vue normal avec des sections indiquant déjà la manche
    case feedStyle // vue programmation
    case plainStyle // vue detail
    //case tournamentResultStyle //vue resultat tournoi
    case followUpStyle // vue normal

    func displayRestingTime() -> Bool {
        switch self {
        case .standardStyle:
            return false
        case .sectionedStandardStyle:
            return false
        case .feedStyle:
            return false
        case .plainStyle:
            return false
//        case .tournamentResultStyle:
//            return false
        case .followUpStyle:
            return true
        }
    }
}

struct MatchViewStyleKey: EnvironmentKey {
    static let defaultValue: MatchViewStyle = .standardStyle
}

extension EnvironmentValues {
    var matchViewStyle: MatchViewStyle {
        get { self[MatchViewStyleKey.self] }
        set { self[MatchViewStyleKey.self] = newValue }
    }
}

extension View {
    func matchViewStyle(_ style: MatchViewStyle) -> some View {
        environment(\.matchViewStyle, style)
    }
}
