@ -55,6 +55,69 @@ public enum ContactManagerError: LocalizedError {
}
}
public enum SummonType : Int , Identifiable {
case contact
case summon
case summonWalkoutFollowUp
case summonErrorFollowUp
public func isRecall ( ) -> Bool {
switch self {
case . contact :
return false
case . summon :
return false
case . summonWalkoutFollowUp :
return true
case . summonErrorFollowUp :
return true
}
}
public func caption ( ) -> String ? {
switch self {
case . contact :
return nil
case . summon :
return nil
case . summonWalkoutFollowUp :
return " Suite à un forfait "
case . summonErrorFollowUp :
return " Suite à une erreur "
}
}
public func shouldConfirm ( ) -> Bool {
switch self {
case . contact :
return false
case . summon :
return true
case . summonWalkoutFollowUp :
return true
case . summonErrorFollowUp :
return true
}
}
public func intro ( ) -> String {
switch self {
case . contact :
return " Vous êtes "
case . summon :
return " Vous êtes "
case . summonWalkoutFollowUp :
return " Suite à des forfaits, vous êtes finalement "
case . summonErrorFollowUp :
return " Suite à une erreur, vous êtes finalement "
}
}
public var id : Int {
self . rawValue
}
}
public enum ContactType : Identifiable {
case mail ( date : Date ? , recipients : [ String ] ? , bccRecipients : [ String ] ? , body : String ? , subject : String ? , tournamentBuild : TournamentBuild ? )
case message ( date : Date ? , recipients : [ String ] ? , body : String ? , tournamentBuild : TournamentBuild ? )
@ -97,7 +160,7 @@ Il est conseillé de vous présenter 10 minutes avant de jouer.\n\nMerci de me c
return text
}
static func callingMessage ( tournament : Tournament ? , startDate : Date ? , roundLabel : String , matchFormat : MatchFormat ? , reSummon : Bool = false ) -> String {
static func callingMessage ( tournament : Tournament ? , startDate : Date ? , roundLabel : String , matchFormat : MatchFormat ? , summonType : SummonType = . summon ) -> String {
let useFullCustomMessage = DataStore . shared . user . summonsUseFullCustomMessage
@ -129,7 +192,7 @@ Il est conseillé de vous présenter 10 minutes avant de jouer.\n\nMerci de me c
[ entryFeeMessage , message , linkMessage ] . compacted ( ) . map { $0 . trimmedMultiline } . joined ( separator : " \n \n " )
}
let intro = reSummon ? " Suite à des forfaits, vous êtes finalement " : " Vous êtes "
let intro = summonType . intro ( )
if let tournament {
return " Bonjour, \n \n \( intro ) \( localizedCalled ) pour jouer en \( roundLabel . lowercased ( ) ) du \( tournament . tournamentTitle ( . title , hideSenior : true ) ) au \( clubName ) le \( date . formatted ( Date . FormatStyle ( ) . weekday ( . wide ) . day ( ) . month ( . wide ) ) ) à \( date . formatted ( Date . FormatStyle ( ) . hour ( ) . minute ( ) ) ) . \n \n " + computedMessage + " \n \n \( signature ) "