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.
 
 
PadelClubData/PadelClubData/Data/Gen/BaseTournament.swift

625 lines
35 KiB

// Generated by SwiftModelGenerator
// Do not modify this file manually
import Foundation
import LeStorage
import SwiftUI
@Observable
public class BaseTournament: SyncedModelObject, SyncedStorable {
public static func resourceName() -> String { return "tournaments" }
public static func tokenExemptedMethods() -> [HTTPMethod] { return [] }
public static var copyServerResponse: Bool = false
public var id: String = Store.randomId()
public var event: String? = nil
public var name: String? = nil
public var startDate: Date = Date()
public var endDate: Date? = nil
public var creationDate: Date = Date()
public var isPrivate: Bool = false
public var groupStageFormat: MatchFormat? = nil
public var roundFormat: MatchFormat? = nil
public var loserRoundFormat: MatchFormat? = nil
public var groupStageSortMode: GroupStageOrderingMode = GroupStageOrderingMode.snake
public var groupStageCount: Int = 4
public var rankSourceDate: Date? = nil
public var dayDuration: Int = 1
public var teamCount: Int = 24
public var teamSorting: TeamSortingType = TeamSortingType.inscriptionDate
public var federalCategory: TournamentCategory = TournamentCategory.men
public var federalLevelCategory: TournamentLevel = TournamentLevel.p100
public var federalAgeCategory: FederalTournamentAge = FederalTournamentAge.senior
public var closedRegistrationDate: Date? = nil
public var groupStageAdditionalQualified: Int = 0
public var courtCount: Int = 2
public var prioritizeClubMembers: Bool = false
public var qualifiedPerGroupStage: Int = 1
public var teamsPerGroupStage: Int = 4
public var entryFee: Double? = nil
public var payment: TournamentPayment? = nil
public var additionalEstimationDuration: Int = 0
public var isDeleted: Bool = false
public var isCanceled: Bool = false
public var publishTeams: Bool = false
public var publishSummons: Bool = false
public var publishGroupStages: Bool = false
public var publishBrackets: Bool = false
public var shouldVerifyGroupStage: Bool = false
public var shouldVerifyBracket: Bool = false
public var hideTeamsWeight: Bool = false
public var publishTournament: Bool = false
public var hidePointsEarned: Bool = false
public var publishRankings: Bool = false
public var loserBracketMode: LoserBracketMode = .automatic
public var initialSeedRound: Int = 0
public var initialSeedCount: Int = 0
public var enableOnlineRegistration: Bool = false
public var registrationDateLimit: Date? = nil
public var openingRegistrationDate: Date? = nil
public var waitingListLimit: Int? = nil
public var accountIsRequired: Bool = true
public var licenseIsRequired: Bool = true
public var minimumPlayerPerTeam: Int = 2
public var maximumPlayerPerTeam: Int = 2
public var information: String? = nil
public var umpireCustomMail: String? = nil
public var umpireCustomContact: String? = nil
public var umpireCustomPhone: String? = nil
public var hideUmpireMail: Bool = false
public var hideUmpirePhone: Bool = true
public var disableRankingFederalRuling: Bool = false
public var teamCountLimit: Bool = true
public var enableOnlinePayment: Bool = false
public var onlinePaymentIsMandatory: Bool = false
public var enableOnlinePaymentRefund: Bool = false
public var refundDateLimit: Date? = nil
public var stripeAccountId: String? = nil
public var enableTimeToConfirm: Bool = false
public var isCorporateTournament: Bool = false
public var isTemplate: Bool = false
public var publishProg: Bool = false
public var showTeamsInProg: Bool = false
public var clubMemberFeeDeduction: Double? = nil
public var unregisterDeltaInHours: Int = 24
public var currencyCode: String? = nil
public init(
id: String = Store.randomId(),
event: String? = nil,
name: String? = nil,
startDate: Date = Date(),
endDate: Date? = nil,
creationDate: Date = Date(),
isPrivate: Bool = false,
groupStageFormat: MatchFormat? = nil,
roundFormat: MatchFormat? = nil,
loserRoundFormat: MatchFormat? = nil,
groupStageSortMode: GroupStageOrderingMode = GroupStageOrderingMode.snake,
groupStageCount: Int = 4,
rankSourceDate: Date? = nil,
dayDuration: Int = 1,
teamCount: Int = 24,
teamSorting: TeamSortingType = TeamSortingType.inscriptionDate,
federalCategory: TournamentCategory = TournamentCategory.men,
federalLevelCategory: TournamentLevel = TournamentLevel.p100,
federalAgeCategory: FederalTournamentAge = FederalTournamentAge.senior,
closedRegistrationDate: Date? = nil,
groupStageAdditionalQualified: Int = 0,
courtCount: Int = 2,
prioritizeClubMembers: Bool = false,
qualifiedPerGroupStage: Int = 1,
teamsPerGroupStage: Int = 4,
entryFee: Double? = nil,
payment: TournamentPayment? = nil,
additionalEstimationDuration: Int = 0,
isDeleted: Bool = false,
isCanceled: Bool = false,
publishTeams: Bool = false,
publishSummons: Bool = false,
publishGroupStages: Bool = false,
publishBrackets: Bool = false,
shouldVerifyGroupStage: Bool = false,
shouldVerifyBracket: Bool = false,
hideTeamsWeight: Bool = false,
publishTournament: Bool = false,
hidePointsEarned: Bool = false,
publishRankings: Bool = false,
loserBracketMode: LoserBracketMode = .automatic,
initialSeedRound: Int = 0,
initialSeedCount: Int = 0,
enableOnlineRegistration: Bool = false,
registrationDateLimit: Date? = nil,
openingRegistrationDate: Date? = nil,
waitingListLimit: Int? = nil,
accountIsRequired: Bool = true,
licenseIsRequired: Bool = true,
minimumPlayerPerTeam: Int = 2,
maximumPlayerPerTeam: Int = 2,
information: String? = nil,
umpireCustomMail: String? = nil,
umpireCustomContact: String? = nil,
umpireCustomPhone: String? = nil,
hideUmpireMail: Bool = false,
hideUmpirePhone: Bool = true,
disableRankingFederalRuling: Bool = false,
teamCountLimit: Bool = true,
enableOnlinePayment: Bool = false,
onlinePaymentIsMandatory: Bool = false,
enableOnlinePaymentRefund: Bool = false,
refundDateLimit: Date? = nil,
stripeAccountId: String? = nil,
enableTimeToConfirm: Bool = false,
isCorporateTournament: Bool = false,
isTemplate: Bool = false,
publishProg: Bool = false,
showTeamsInProg: Bool = false,
clubMemberFeeDeduction: Double? = nil,
unregisterDeltaInHours: Int = 24,
currencyCode: String? = nil
) {
super.init()
self.id = id
self.event = event
self.name = name
self.startDate = startDate
self.endDate = endDate
self.creationDate = creationDate
self.isPrivate = isPrivate
self.groupStageFormat = groupStageFormat
self.roundFormat = roundFormat
self.loserRoundFormat = loserRoundFormat
self.groupStageSortMode = groupStageSortMode
self.groupStageCount = groupStageCount
self.rankSourceDate = rankSourceDate
self.dayDuration = dayDuration
self.teamCount = teamCount
self.teamSorting = teamSorting
self.federalCategory = federalCategory
self.federalLevelCategory = federalLevelCategory
self.federalAgeCategory = federalAgeCategory
self.closedRegistrationDate = closedRegistrationDate
self.groupStageAdditionalQualified = groupStageAdditionalQualified
self.courtCount = courtCount
self.prioritizeClubMembers = prioritizeClubMembers
self.qualifiedPerGroupStage = qualifiedPerGroupStage
self.teamsPerGroupStage = teamsPerGroupStage
self.entryFee = entryFee
self.payment = payment
self.additionalEstimationDuration = additionalEstimationDuration
self.isDeleted = isDeleted
self.isCanceled = isCanceled
self.publishTeams = publishTeams
self.publishSummons = publishSummons
self.publishGroupStages = publishGroupStages
self.publishBrackets = publishBrackets
self.shouldVerifyGroupStage = shouldVerifyGroupStage
self.shouldVerifyBracket = shouldVerifyBracket
self.hideTeamsWeight = hideTeamsWeight
self.publishTournament = publishTournament
self.hidePointsEarned = hidePointsEarned
self.publishRankings = publishRankings
self.loserBracketMode = loserBracketMode
self.initialSeedRound = initialSeedRound
self.initialSeedCount = initialSeedCount
self.enableOnlineRegistration = enableOnlineRegistration
self.registrationDateLimit = registrationDateLimit
self.openingRegistrationDate = openingRegistrationDate
self.waitingListLimit = waitingListLimit
self.accountIsRequired = accountIsRequired
self.licenseIsRequired = licenseIsRequired
self.minimumPlayerPerTeam = minimumPlayerPerTeam
self.maximumPlayerPerTeam = maximumPlayerPerTeam
self.information = information
self.umpireCustomMail = umpireCustomMail
self.umpireCustomContact = umpireCustomContact
self.umpireCustomPhone = umpireCustomPhone
self.hideUmpireMail = hideUmpireMail
self.hideUmpirePhone = hideUmpirePhone
self.disableRankingFederalRuling = disableRankingFederalRuling
self.teamCountLimit = teamCountLimit
self.enableOnlinePayment = enableOnlinePayment
self.onlinePaymentIsMandatory = onlinePaymentIsMandatory
self.enableOnlinePaymentRefund = enableOnlinePaymentRefund
self.refundDateLimit = refundDateLimit
self.stripeAccountId = stripeAccountId
self.enableTimeToConfirm = enableTimeToConfirm
self.isCorporateTournament = isCorporateTournament
self.isTemplate = isTemplate
self.publishProg = publishProg
self.showTeamsInProg = showTeamsInProg
self.clubMemberFeeDeduction = clubMemberFeeDeduction
self.unregisterDeltaInHours = unregisterDeltaInHours
self.currencyCode = currencyCode
}
required public override init() {
super.init()
}
public enum CodingKeys: String, CodingKey {
case isCanceled = "isCanceled"
case payment = "payment"
case _id = "id"
case _event = "event"
case _name = "name"
case _startDate = "startDate"
case _endDate = "endDate"
case _creationDate = "creationDate"
case _isPrivate = "isPrivate"
case _groupStageFormat = "groupStageFormat"
case _roundFormat = "roundFormat"
case _loserRoundFormat = "loserRoundFormat"
case _groupStageSortMode = "groupStageSortMode"
case _groupStageCount = "groupStageCount"
case _rankSourceDate = "rankSourceDate"
case _dayDuration = "dayDuration"
case _teamCount = "teamCount"
case _teamSorting = "teamSorting"
case _federalCategory = "federalCategory"
case _federalLevelCategory = "federalLevelCategory"
case _federalAgeCategory = "federalAgeCategory"
case _closedRegistrationDate = "closedRegistrationDate"
case _groupStageAdditionalQualified = "groupStageAdditionalQualified"
case _courtCount = "courtCount"
case _prioritizeClubMembers = "prioritizeClubMembers"
case _qualifiedPerGroupStage = "qualifiedPerGroupStage"
case _teamsPerGroupStage = "teamsPerGroupStage"
case _entryFee = "entryFee"
case _payment = "globalId"
case _additionalEstimationDuration = "additionalEstimationDuration"
case _isDeleted = "isDeleted"
case _isCanceled = "localId"
case _publishTeams = "publishTeams"
case _publishSummons = "publishSummons"
case _publishGroupStages = "publishGroupStages"
case _publishBrackets = "publishBrackets"
case _shouldVerifyGroupStage = "shouldVerifyGroupStage"
case _shouldVerifyBracket = "shouldVerifyBracket"
case _hideTeamsWeight = "hideTeamsWeight"
case _publishTournament = "publishTournament"
case _hidePointsEarned = "hidePointsEarned"
case _publishRankings = "publishRankings"
case _loserBracketMode = "loserBracketMode"
case _initialSeedRound = "initialSeedRound"
case _initialSeedCount = "initialSeedCount"
case _enableOnlineRegistration = "enableOnlineRegistration"
case _registrationDateLimit = "registrationDateLimit"
case _openingRegistrationDate = "openingRegistrationDate"
case _waitingListLimit = "waitingListLimit"
case _accountIsRequired = "accountIsRequired"
case _licenseIsRequired = "licenseIsRequired"
case _minimumPlayerPerTeam = "minimumPlayerPerTeam"
case _maximumPlayerPerTeam = "maximumPlayerPerTeam"
case _information = "information"
case _umpireCustomMail = "umpireCustomMail"
case _umpireCustomContact = "umpireCustomContact"
case _umpireCustomPhone = "umpireCustomPhone"
case _hideUmpireMail = "hideUmpireMail"
case _hideUmpirePhone = "hideUmpirePhone"
case _disableRankingFederalRuling = "disableRankingFederalRuling"
case _teamCountLimit = "teamCountLimit"
case _enableOnlinePayment = "enableOnlinePayment"
case _onlinePaymentIsMandatory = "onlinePaymentIsMandatory"
case _enableOnlinePaymentRefund = "enableOnlinePaymentRefund"
case _refundDateLimit = "refundDateLimit"
case _stripeAccountId = "stripeAccountId"
case _enableTimeToConfirm = "enableTimeToConfirm"
case _isCorporateTournament = "isCorporateTournament"
case _isTemplate = "isTemplate"
case _publishProg = "publishProg"
case _showTeamsInProg = "showTeamsInProg"
case _clubMemberFeeDeduction = "clubMemberFeeDeduction"
case _unregisterDeltaInHours = "unregisterDeltaInHours"
case _currencyCode = "currencyCode"
}
private static func _decodePayment(container: KeyedDecodingContainer<CodingKeys>) throws -> TournamentPayment? {
var data = try container.decodeIfPresent(Data.self, forKey: ._payment)
if data == nil {
data = try container.decodeIfPresent(Data.self, forKey: .payment)
}
if let data {
do {
let decoded: String = try data.decryptData(pass: CryptoKey.pass.rawValue)
let sequence = decoded.compactMap { NumberFormatter.standard.number(from: String($0))?.intValue }
return TournamentPayment(rawValue: sequence[18])
} catch {
Logger.error(error)
}
}
return nil
}
private func _encodePayment(container: inout KeyedEncodingContainer<CodingKeys>) throws {
guard let payment else {
try container.encodeNil(forKey: ._payment)
return
}
let max: Int = TournamentPayment.allCases.count
var sequence = (1...18).map { _ in Int.random(in: (0..<max)) }
sequence.append(payment.rawValue)
sequence.append(contentsOf: (1...13).map { _ in Int.random(in: (0..<max ))} )
let stringCombo: [String] = sequence.map { $0.formatted() }
let joined: String = stringCombo.joined(separator: "")
if let data = joined.data(using: .utf8) {
let encryped: Data = try data.encrypt(pass: CryptoKey.pass.rawValue)
try container.encodeIfPresent(encryped, forKey: ._payment)
}
}
private static func _decodeIscanceled(container: KeyedDecodingContainer<CodingKeys>) throws -> Bool {
var data = try container.decodeIfPresent(Data.self, forKey: ._isCanceled)
if data == nil {
data = try container.decodeIfPresent(Data.self, forKey: .isCanceled)
}
if let data {
do {
let decoded: String = try data.decryptData(pass: CryptoKey.pass.rawValue)
let sequence = decoded.compactMap { NumberFormatter.standard.number(from: String($0))?.intValue }
return Bool.decodeInt(sequence[18])
} catch {
Logger.error(error)
}
}
return false
}
private func _encodeIscanceled(container: inout KeyedEncodingContainer<CodingKeys>) throws {
let max: Int = 9
var sequence = (1...18).map { _ in Int.random(in: (0...max)) }
sequence.append(self.isCanceled.encodedValue)
sequence.append(contentsOf: (1...13).map { _ in Int.random(in: (0...max ))} )
let stringCombo: [String] = sequence.map { $0.formatted() }
let joined: String = stringCombo.joined(separator: "")
if let data = joined.data(using: .utf8) {
let encryped: Data = try data.encrypt(pass: CryptoKey.pass.rawValue)
try container.encode(encryped, forKey: ._isCanceled)
}
}
required init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId()
self.event = try container.decodeIfPresent(String.self, forKey: ._event) ?? nil
self.name = try container.decodeIfPresent(String.self, forKey: ._name) ?? nil
self.startDate = try container.decodeIfPresent(Date.self, forKey: ._startDate) ?? Date()
self.endDate = try container.decodeIfPresent(Date.self, forKey: ._endDate) ?? nil
self.creationDate = try container.decodeIfPresent(Date.self, forKey: ._creationDate) ?? Date()
self.isPrivate = try container.decodeIfPresent(Bool.self, forKey: ._isPrivate) ?? false
self.groupStageFormat = try container.decodeIfPresent(MatchFormat.self, forKey: ._groupStageFormat) ?? nil
self.roundFormat = try container.decodeIfPresent(MatchFormat.self, forKey: ._roundFormat) ?? nil
self.loserRoundFormat = try container.decodeIfPresent(MatchFormat.self, forKey: ._loserRoundFormat) ?? nil
self.groupStageSortMode = try container.decodeIfPresent(GroupStageOrderingMode.self, forKey: ._groupStageSortMode) ?? GroupStageOrderingMode.snake
self.groupStageCount = try container.decodeIfPresent(Int.self, forKey: ._groupStageCount) ?? 4
self.rankSourceDate = try container.decodeIfPresent(Date.self, forKey: ._rankSourceDate) ?? nil
self.dayDuration = try container.decodeIfPresent(Int.self, forKey: ._dayDuration) ?? 1
self.teamCount = try container.decodeIfPresent(Int.self, forKey: ._teamCount) ?? 24
self.teamSorting = try container.decodeIfPresent(TeamSortingType.self, forKey: ._teamSorting) ?? TeamSortingType.inscriptionDate
self.federalCategory = try container.decodeIfPresent(TournamentCategory.self, forKey: ._federalCategory) ?? TournamentCategory.men
self.federalLevelCategory = try container.decodeIfPresent(TournamentLevel.self, forKey: ._federalLevelCategory) ?? TournamentLevel.p100
self.federalAgeCategory = try container.decodeIfPresent(FederalTournamentAge.self, forKey: ._federalAgeCategory) ?? FederalTournamentAge.senior
self.closedRegistrationDate = try container.decodeIfPresent(Date.self, forKey: ._closedRegistrationDate) ?? nil
self.groupStageAdditionalQualified = try container.decodeIfPresent(Int.self, forKey: ._groupStageAdditionalQualified) ?? 0
self.courtCount = try container.decodeIfPresent(Int.self, forKey: ._courtCount) ?? 2
self.prioritizeClubMembers = try container.decodeIfPresent(Bool.self, forKey: ._prioritizeClubMembers) ?? false
self.qualifiedPerGroupStage = try container.decodeIfPresent(Int.self, forKey: ._qualifiedPerGroupStage) ?? 1
self.teamsPerGroupStage = try container.decodeIfPresent(Int.self, forKey: ._teamsPerGroupStage) ?? 4
self.entryFee = try container.decodeIfPresent(Double.self, forKey: ._entryFee) ?? nil
self.payment = try Self._decodePayment(container: container)
self.additionalEstimationDuration = try container.decodeIfPresent(Int.self, forKey: ._additionalEstimationDuration) ?? 0
self.isDeleted = try container.decodeIfPresent(Bool.self, forKey: ._isDeleted) ?? false
self.isCanceled = try Self._decodeIscanceled(container: container)
self.publishTeams = try container.decodeIfPresent(Bool.self, forKey: ._publishTeams) ?? false
self.publishSummons = try container.decodeIfPresent(Bool.self, forKey: ._publishSummons) ?? false
self.publishGroupStages = try container.decodeIfPresent(Bool.self, forKey: ._publishGroupStages) ?? false
self.publishBrackets = try container.decodeIfPresent(Bool.self, forKey: ._publishBrackets) ?? false
self.shouldVerifyGroupStage = try container.decodeIfPresent(Bool.self, forKey: ._shouldVerifyGroupStage) ?? false
self.shouldVerifyBracket = try container.decodeIfPresent(Bool.self, forKey: ._shouldVerifyBracket) ?? false
self.hideTeamsWeight = try container.decodeIfPresent(Bool.self, forKey: ._hideTeamsWeight) ?? false
self.publishTournament = try container.decodeIfPresent(Bool.self, forKey: ._publishTournament) ?? false
self.hidePointsEarned = try container.decodeIfPresent(Bool.self, forKey: ._hidePointsEarned) ?? false
self.publishRankings = try container.decodeIfPresent(Bool.self, forKey: ._publishRankings) ?? false
self.loserBracketMode = try container.decodeIfPresent(LoserBracketMode.self, forKey: ._loserBracketMode) ?? .automatic
self.initialSeedRound = try container.decodeIfPresent(Int.self, forKey: ._initialSeedRound) ?? 0
self.initialSeedCount = try container.decodeIfPresent(Int.self, forKey: ._initialSeedCount) ?? 0
self.enableOnlineRegistration = try container.decodeIfPresent(Bool.self, forKey: ._enableOnlineRegistration) ?? false
self.registrationDateLimit = try container.decodeIfPresent(Date.self, forKey: ._registrationDateLimit) ?? nil
self.openingRegistrationDate = try container.decodeIfPresent(Date.self, forKey: ._openingRegistrationDate) ?? nil
self.waitingListLimit = try container.decodeIfPresent(Int.self, forKey: ._waitingListLimit) ?? nil
self.accountIsRequired = try container.decodeIfPresent(Bool.self, forKey: ._accountIsRequired) ?? true
self.licenseIsRequired = try container.decodeIfPresent(Bool.self, forKey: ._licenseIsRequired) ?? true
self.minimumPlayerPerTeam = try container.decodeIfPresent(Int.self, forKey: ._minimumPlayerPerTeam) ?? 2
self.maximumPlayerPerTeam = try container.decodeIfPresent(Int.self, forKey: ._maximumPlayerPerTeam) ?? 2
self.information = try container.decodeIfPresent(String.self, forKey: ._information) ?? nil
self.umpireCustomMail = try container.decodeIfPresent(String.self, forKey: ._umpireCustomMail) ?? nil
self.umpireCustomContact = try container.decodeIfPresent(String.self, forKey: ._umpireCustomContact) ?? nil
self.umpireCustomPhone = try container.decodeIfPresent(String.self, forKey: ._umpireCustomPhone) ?? nil
self.hideUmpireMail = try container.decodeIfPresent(Bool.self, forKey: ._hideUmpireMail) ?? false
self.hideUmpirePhone = try container.decodeIfPresent(Bool.self, forKey: ._hideUmpirePhone) ?? true
self.disableRankingFederalRuling = try container.decodeIfPresent(Bool.self, forKey: ._disableRankingFederalRuling) ?? false
self.teamCountLimit = try container.decodeIfPresent(Bool.self, forKey: ._teamCountLimit) ?? true
self.enableOnlinePayment = try container.decodeIfPresent(Bool.self, forKey: ._enableOnlinePayment) ?? false
self.onlinePaymentIsMandatory = try container.decodeIfPresent(Bool.self, forKey: ._onlinePaymentIsMandatory) ?? false
self.enableOnlinePaymentRefund = try container.decodeIfPresent(Bool.self, forKey: ._enableOnlinePaymentRefund) ?? false
self.refundDateLimit = try container.decodeIfPresent(Date.self, forKey: ._refundDateLimit) ?? nil
self.stripeAccountId = try container.decodeIfPresent(String.self, forKey: ._stripeAccountId) ?? nil
self.enableTimeToConfirm = try container.decodeIfPresent(Bool.self, forKey: ._enableTimeToConfirm) ?? false
self.isCorporateTournament = try container.decodeIfPresent(Bool.self, forKey: ._isCorporateTournament) ?? false
self.isTemplate = try container.decodeIfPresent(Bool.self, forKey: ._isTemplate) ?? false
self.publishProg = try container.decodeIfPresent(Bool.self, forKey: ._publishProg) ?? false
self.showTeamsInProg = try container.decodeIfPresent(Bool.self, forKey: ._showTeamsInProg) ?? false
self.clubMemberFeeDeduction = try container.decodeIfPresent(Double.self, forKey: ._clubMemberFeeDeduction) ?? nil
self.unregisterDeltaInHours = try container.decodeIfPresent(Int.self, forKey: ._unregisterDeltaInHours) ?? 24
self.currencyCode = try container.decodeIfPresent(String.self, forKey: ._currencyCode) ?? nil
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.id, forKey: ._id)
try container.encode(self.event, forKey: ._event)
try container.encode(self.name, forKey: ._name)
try container.encode(self.startDate, forKey: ._startDate)
try container.encode(self.endDate, forKey: ._endDate)
try container.encode(self.creationDate, forKey: ._creationDate)
try container.encode(self.isPrivate, forKey: ._isPrivate)
try container.encode(self.groupStageFormat, forKey: ._groupStageFormat)
try container.encode(self.roundFormat, forKey: ._roundFormat)
try container.encode(self.loserRoundFormat, forKey: ._loserRoundFormat)
try container.encode(self.groupStageSortMode, forKey: ._groupStageSortMode)
try container.encode(self.groupStageCount, forKey: ._groupStageCount)
try container.encode(self.rankSourceDate, forKey: ._rankSourceDate)
try container.encode(self.dayDuration, forKey: ._dayDuration)
try container.encode(self.teamCount, forKey: ._teamCount)
try container.encode(self.teamSorting, forKey: ._teamSorting)
try container.encode(self.federalCategory, forKey: ._federalCategory)
try container.encode(self.federalLevelCategory, forKey: ._federalLevelCategory)
try container.encode(self.federalAgeCategory, forKey: ._federalAgeCategory)
try container.encode(self.closedRegistrationDate, forKey: ._closedRegistrationDate)
try container.encode(self.groupStageAdditionalQualified, forKey: ._groupStageAdditionalQualified)
try container.encode(self.courtCount, forKey: ._courtCount)
try container.encode(self.prioritizeClubMembers, forKey: ._prioritizeClubMembers)
try container.encode(self.qualifiedPerGroupStage, forKey: ._qualifiedPerGroupStage)
try container.encode(self.teamsPerGroupStage, forKey: ._teamsPerGroupStage)
try container.encode(self.entryFee, forKey: ._entryFee)
try _encodePayment(container: &container)
try container.encode(self.additionalEstimationDuration, forKey: ._additionalEstimationDuration)
try container.encode(self.isDeleted, forKey: ._isDeleted)
try _encodeIscanceled(container: &container)
try container.encode(self.publishTeams, forKey: ._publishTeams)
try container.encode(self.publishSummons, forKey: ._publishSummons)
try container.encode(self.publishGroupStages, forKey: ._publishGroupStages)
try container.encode(self.publishBrackets, forKey: ._publishBrackets)
try container.encode(self.shouldVerifyGroupStage, forKey: ._shouldVerifyGroupStage)
try container.encode(self.shouldVerifyBracket, forKey: ._shouldVerifyBracket)
try container.encode(self.hideTeamsWeight, forKey: ._hideTeamsWeight)
try container.encode(self.publishTournament, forKey: ._publishTournament)
try container.encode(self.hidePointsEarned, forKey: ._hidePointsEarned)
try container.encode(self.publishRankings, forKey: ._publishRankings)
try container.encode(self.loserBracketMode, forKey: ._loserBracketMode)
try container.encode(self.initialSeedRound, forKey: ._initialSeedRound)
try container.encode(self.initialSeedCount, forKey: ._initialSeedCount)
try container.encode(self.enableOnlineRegistration, forKey: ._enableOnlineRegistration)
try container.encode(self.registrationDateLimit, forKey: ._registrationDateLimit)
try container.encode(self.openingRegistrationDate, forKey: ._openingRegistrationDate)
try container.encode(self.waitingListLimit, forKey: ._waitingListLimit)
try container.encode(self.accountIsRequired, forKey: ._accountIsRequired)
try container.encode(self.licenseIsRequired, forKey: ._licenseIsRequired)
try container.encode(self.minimumPlayerPerTeam, forKey: ._minimumPlayerPerTeam)
try container.encode(self.maximumPlayerPerTeam, forKey: ._maximumPlayerPerTeam)
try container.encode(self.information, forKey: ._information)
try container.encode(self.umpireCustomMail, forKey: ._umpireCustomMail)
try container.encode(self.umpireCustomContact, forKey: ._umpireCustomContact)
try container.encode(self.umpireCustomPhone, forKey: ._umpireCustomPhone)
try container.encode(self.hideUmpireMail, forKey: ._hideUmpireMail)
try container.encode(self.hideUmpirePhone, forKey: ._hideUmpirePhone)
try container.encode(self.disableRankingFederalRuling, forKey: ._disableRankingFederalRuling)
try container.encode(self.teamCountLimit, forKey: ._teamCountLimit)
try container.encode(self.enableOnlinePayment, forKey: ._enableOnlinePayment)
try container.encode(self.onlinePaymentIsMandatory, forKey: ._onlinePaymentIsMandatory)
try container.encode(self.enableOnlinePaymentRefund, forKey: ._enableOnlinePaymentRefund)
try container.encode(self.refundDateLimit, forKey: ._refundDateLimit)
try container.encode(self.stripeAccountId, forKey: ._stripeAccountId)
try container.encode(self.enableTimeToConfirm, forKey: ._enableTimeToConfirm)
try container.encode(self.isCorporateTournament, forKey: ._isCorporateTournament)
try container.encode(self.isTemplate, forKey: ._isTemplate)
try container.encode(self.publishProg, forKey: ._publishProg)
try container.encode(self.showTeamsInProg, forKey: ._showTeamsInProg)
try container.encode(self.clubMemberFeeDeduction, forKey: ._clubMemberFeeDeduction)
try container.encode(self.unregisterDeltaInHours, forKey: ._unregisterDeltaInHours)
try container.encode(self.currencyCode, forKey: ._currencyCode)
try super.encode(to: encoder)
}
func eventValue() -> Event? {
guard let event = self.event else { return nil }
return Store.main.findById(event)
}
public func copy(from other: any Storable) {
guard let tournament = other as? BaseTournament else { return }
self.id = tournament.id
self.event = tournament.event
self.name = tournament.name
self.startDate = tournament.startDate
self.endDate = tournament.endDate
self.creationDate = tournament.creationDate
self.isPrivate = tournament.isPrivate
self.groupStageFormat = tournament.groupStageFormat
self.roundFormat = tournament.roundFormat
self.loserRoundFormat = tournament.loserRoundFormat
self.groupStageSortMode = tournament.groupStageSortMode
self.groupStageCount = tournament.groupStageCount
self.rankSourceDate = tournament.rankSourceDate
self.dayDuration = tournament.dayDuration
self.teamCount = tournament.teamCount
self.teamSorting = tournament.teamSorting
self.federalCategory = tournament.federalCategory
self.federalLevelCategory = tournament.federalLevelCategory
self.federalAgeCategory = tournament.federalAgeCategory
self.closedRegistrationDate = tournament.closedRegistrationDate
self.groupStageAdditionalQualified = tournament.groupStageAdditionalQualified
self.courtCount = tournament.courtCount
self.prioritizeClubMembers = tournament.prioritizeClubMembers
self.qualifiedPerGroupStage = tournament.qualifiedPerGroupStage
self.teamsPerGroupStage = tournament.teamsPerGroupStage
self.entryFee = tournament.entryFee
self.payment = tournament.payment
self.additionalEstimationDuration = tournament.additionalEstimationDuration
self.isDeleted = tournament.isDeleted
self.isCanceled = tournament.isCanceled
self.publishTeams = tournament.publishTeams
self.publishSummons = tournament.publishSummons
self.publishGroupStages = tournament.publishGroupStages
self.publishBrackets = tournament.publishBrackets
self.shouldVerifyGroupStage = tournament.shouldVerifyGroupStage
self.shouldVerifyBracket = tournament.shouldVerifyBracket
self.hideTeamsWeight = tournament.hideTeamsWeight
self.publishTournament = tournament.publishTournament
self.hidePointsEarned = tournament.hidePointsEarned
self.publishRankings = tournament.publishRankings
self.loserBracketMode = tournament.loserBracketMode
self.initialSeedRound = tournament.initialSeedRound
self.initialSeedCount = tournament.initialSeedCount
self.enableOnlineRegistration = tournament.enableOnlineRegistration
self.registrationDateLimit = tournament.registrationDateLimit
self.openingRegistrationDate = tournament.openingRegistrationDate
self.waitingListLimit = tournament.waitingListLimit
self.accountIsRequired = tournament.accountIsRequired
self.licenseIsRequired = tournament.licenseIsRequired
self.minimumPlayerPerTeam = tournament.minimumPlayerPerTeam
self.maximumPlayerPerTeam = tournament.maximumPlayerPerTeam
self.information = tournament.information
self.umpireCustomMail = tournament.umpireCustomMail
self.umpireCustomContact = tournament.umpireCustomContact
self.umpireCustomPhone = tournament.umpireCustomPhone
self.hideUmpireMail = tournament.hideUmpireMail
self.hideUmpirePhone = tournament.hideUmpirePhone
self.disableRankingFederalRuling = tournament.disableRankingFederalRuling
self.teamCountLimit = tournament.teamCountLimit
self.enableOnlinePayment = tournament.enableOnlinePayment
self.onlinePaymentIsMandatory = tournament.onlinePaymentIsMandatory
self.enableOnlinePaymentRefund = tournament.enableOnlinePaymentRefund
self.refundDateLimit = tournament.refundDateLimit
self.stripeAccountId = tournament.stripeAccountId
self.enableTimeToConfirm = tournament.enableTimeToConfirm
self.isCorporateTournament = tournament.isCorporateTournament
self.isTemplate = tournament.isTemplate
self.publishProg = tournament.publishProg
self.showTeamsInProg = tournament.showTeamsInProg
self.clubMemberFeeDeduction = tournament.clubMemberFeeDeduction
self.unregisterDeltaInHours = tournament.unregisterDeltaInHours
self.currencyCode = tournament.currencyCode
}
public static func relationships() -> [Relationship] {
return [
Relationship(type: Event.self, keyPath: \BaseTournament.event),
]
}
}