//
//  FederalTournamentHolder.swift
//  Padel Tournament
//
//  Created by Razmig Sarkissian on 13/11/2023.
//

import Foundation

protocol FederalTournamentHolder {
    var holderId: String { get }
    var startDate: Date { get }
    var endDate: Date? { get }
    var codeClub: String? { get }
    var tournaments: [any TournamentBuildHolder] { get }
    func clubLabel() -> String
    func subtitleLabel(forBuild build: any TournamentBuildHolder) -> String
    var dayDuration: Int { get }
    var dayPeriod: DayPeriod { get }
    func tournamentTitle(_ displayStyle: DisplayStyle, forBuild build: any TournamentBuildHolder) -> String
    func displayAgeAndCategory(forBuild build: any TournamentBuildHolder) -> Bool
}

extension FederalTournamentHolder {
    func durationLabel() -> String {
        switch dayDuration {
        case 1:
            return (startDate.timeOfDay == .evening ? "Soir" : "Journée")
        default:
            return dayDuration.formatted() + " jours"
        }
    }
}
