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/Gen/BaseTeamRegistration.swift

199 lines
8.9 KiB

// Generated by SwiftModelGenerator
// Do not modify this file manually
import Foundation
import LeStorage
import SwiftUI
@Observable
class BaseTeamRegistration: SyncedModelObject, SyncedStorable {
static func resourceName() -> String { return "team-registrations" }
static func tokenExemptedMethods() -> [HTTPMethod] { return [] }
static var copyServerResponse: Bool = false
var id: String = Store.randomId()
var tournament: String = ""
var groupStage: String? = nil
var registrationDate: Date? = nil
var callDate: Date? = nil
var bracketPosition: Int? = nil
var groupStagePosition: Int? = nil
var comment: String? = nil
var source: String? = nil
var sourceValue: String? = nil
var logo: String? = nil
var name: String? = nil
var walkOut: Bool = false
var wildCardBracket: Bool = false
var wildCardGroupStage: Bool = false
var weight: Int = 0
var lockedWeight: Int? = nil
var confirmationDate: Date? = nil
var qualified: Bool = false
var finalRanking: Int? = nil
var pointsEarned: Int? = nil
init(
id: String = Store.randomId(),
tournament: String = "",
groupStage: String? = nil,
registrationDate: Date? = nil,
callDate: Date? = nil,
bracketPosition: Int? = nil,
groupStagePosition: Int? = nil,
comment: String? = nil,
source: String? = nil,
sourceValue: String? = nil,
logo: String? = nil,
name: String? = nil,
walkOut: Bool = false,
wildCardBracket: Bool = false,
wildCardGroupStage: Bool = false,
weight: Int = 0,
lockedWeight: Int? = nil,
confirmationDate: Date? = nil,
qualified: Bool = false,
finalRanking: Int? = nil,
pointsEarned: Int? = nil
) {
super.init()
self.id = id
self.tournament = tournament
self.groupStage = groupStage
self.registrationDate = registrationDate
self.callDate = callDate
self.bracketPosition = bracketPosition
self.groupStagePosition = groupStagePosition
self.comment = comment
self.source = source
self.sourceValue = sourceValue
self.logo = logo
self.name = name
self.walkOut = walkOut
self.wildCardBracket = wildCardBracket
self.wildCardGroupStage = wildCardGroupStage
self.weight = weight
self.lockedWeight = lockedWeight
self.confirmationDate = confirmationDate
self.qualified = qualified
self.finalRanking = finalRanking
self.pointsEarned = pointsEarned
}
required public override init() {
super.init()
}
enum CodingKeys: String, CodingKey {
case _id = "id"
case _tournament = "tournament"
case _groupStage = "groupStage"
case _registrationDate = "registrationDate"
case _callDate = "callDate"
case _bracketPosition = "bracketPosition"
case _groupStagePosition = "groupStagePosition"
case _comment = "comment"
case _source = "source"
case _sourceValue = "sourceValue"
case _logo = "logo"
case _name = "name"
case _walkOut = "walkOut"
case _wildCardBracket = "wildCardBracket"
case _wildCardGroupStage = "wildCardGroupStage"
case _weight = "weight"
case _lockedWeight = "lockedWeight"
case _confirmationDate = "confirmationDate"
case _qualified = "qualified"
case _finalRanking = "finalRanking"
case _pointsEarned = "pointsEarned"
}
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.tournament = try container.decodeIfPresent(String.self, forKey: ._tournament) ?? ""
self.groupStage = try container.decodeIfPresent(String.self, forKey: ._groupStage) ?? nil
self.registrationDate = try container.decodeIfPresent(Date.self, forKey: ._registrationDate) ?? nil
self.callDate = try container.decodeIfPresent(Date.self, forKey: ._callDate) ?? nil
self.bracketPosition = try container.decodeIfPresent(Int.self, forKey: ._bracketPosition) ?? nil
self.groupStagePosition = try container.decodeIfPresent(Int.self, forKey: ._groupStagePosition) ?? nil
self.comment = try container.decodeIfPresent(String.self, forKey: ._comment) ?? nil
self.source = try container.decodeIfPresent(String.self, forKey: ._source) ?? nil
self.sourceValue = try container.decodeIfPresent(String.self, forKey: ._sourceValue) ?? nil
self.logo = try container.decodeIfPresent(String.self, forKey: ._logo) ?? nil
self.name = try container.decodeIfPresent(String.self, forKey: ._name) ?? nil
self.walkOut = try container.decodeIfPresent(Bool.self, forKey: ._walkOut) ?? false
self.wildCardBracket = try container.decodeIfPresent(Bool.self, forKey: ._wildCardBracket) ?? false
self.wildCardGroupStage = try container.decodeIfPresent(Bool.self, forKey: ._wildCardGroupStage) ?? false
self.weight = try container.decodeIfPresent(Int.self, forKey: ._weight) ?? 0
self.lockedWeight = try container.decodeIfPresent(Int.self, forKey: ._lockedWeight) ?? nil
self.confirmationDate = try container.decodeIfPresent(Date.self, forKey: ._confirmationDate) ?? nil
self.qualified = try container.decodeIfPresent(Bool.self, forKey: ._qualified) ?? false
self.finalRanking = try container.decodeIfPresent(Int.self, forKey: ._finalRanking) ?? nil
self.pointsEarned = try container.decodeIfPresent(Int.self, forKey: ._pointsEarned) ?? nil
try super.init(from: decoder)
}
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.tournament, forKey: ._tournament)
try container.encode(self.groupStage, forKey: ._groupStage)
try container.encode(self.registrationDate, forKey: ._registrationDate)
try container.encode(self.callDate, forKey: ._callDate)
try container.encode(self.bracketPosition, forKey: ._bracketPosition)
try container.encode(self.groupStagePosition, forKey: ._groupStagePosition)
try container.encode(self.comment, forKey: ._comment)
try container.encode(self.source, forKey: ._source)
try container.encode(self.sourceValue, forKey: ._sourceValue)
try container.encode(self.logo, forKey: ._logo)
try container.encode(self.name, forKey: ._name)
try container.encode(self.walkOut, forKey: ._walkOut)
try container.encode(self.wildCardBracket, forKey: ._wildCardBracket)
try container.encode(self.wildCardGroupStage, forKey: ._wildCardGroupStage)
try container.encode(self.weight, forKey: ._weight)
try container.encode(self.lockedWeight, forKey: ._lockedWeight)
try container.encode(self.confirmationDate, forKey: ._confirmationDate)
try container.encode(self.qualified, forKey: ._qualified)
try container.encode(self.finalRanking, forKey: ._finalRanking)
try container.encode(self.pointsEarned, forKey: ._pointsEarned)
try super.encode(to: encoder)
}
func groupStageValue() -> GroupStage? {
guard let groupStage = self.groupStage else { return nil }
return self.store?.findById(groupStage)
}
func copy(from other: any Storable) {
guard let teamregistration = other as? BaseTeamRegistration else { return }
self.id = teamregistration.id
self.tournament = teamregistration.tournament
self.groupStage = teamregistration.groupStage
self.registrationDate = teamregistration.registrationDate
self.callDate = teamregistration.callDate
self.bracketPosition = teamregistration.bracketPosition
self.groupStagePosition = teamregistration.groupStagePosition
self.comment = teamregistration.comment
self.source = teamregistration.source
self.sourceValue = teamregistration.sourceValue
self.logo = teamregistration.logo
self.name = teamregistration.name
self.walkOut = teamregistration.walkOut
self.wildCardBracket = teamregistration.wildCardBracket
self.wildCardGroupStage = teamregistration.wildCardGroupStage
self.weight = teamregistration.weight
self.lockedWeight = teamregistration.lockedWeight
self.confirmationDate = teamregistration.confirmationDate
self.qualified = teamregistration.qualified
self.finalRanking = teamregistration.finalRanking
self.pointsEarned = teamregistration.pointsEarned
}
static func relationships() -> [Relationship] {
return [
Relationship(type: GroupStage.self, keyPath: \BaseTeamRegistration.groupStage),
]
}
}