You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
PadelClub/PadelClub/Data/Federal/PlayerHolder.swift

57 lines
1.3 KiB

//
// PlayerHolder.swift
// PadelClub
//
// Created by Razmig Sarkissian on 24/04/2024.
//
import Foundation
import SwiftUI
protocol PlayerHolder {
func getFirstName() -> String
func getLastName() -> String
func formattedRank() -> String
func formattedLicense() -> String
func getPoints() -> Double?
func getRank() -> Int?
func isUnranked() -> Bool
var male: Bool { get }
var tournamentPlayed: Int? { get }
var clubName: String? { get }
var ligueName: String? { get }
var assimilation: String? { get }
var computedAge: Int? { get }
func getAssimilatedAsMaleRank() -> Int?
func isNotFromCurrentDate() -> Bool
func getBirthYear() -> Int?
func getProgression() -> Int
func getComputedRank() -> Int?
}
extension PlayerHolder {
func isNotFromCurrentDate() -> Bool {
false
}
var isAssimilated: Bool {
assimilation == "Oui"
}
func isAnonymous() -> Bool {
getFirstName().isEmpty && getLastName().isEmpty
}
func getProgressionColor(progression: Int) -> Color {
switch progression {
case _ where progression > 0:
return Color.green
case _ where progression < 0:
return Color.logoRed
default:
return Color.primary
}
}
}