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.
262 lines
13 KiB
262 lines
13 KiB
// Generated by SwiftModelGenerator
|
|
// Do not modify this file manually
|
|
|
|
import Foundation
|
|
import LeStorage
|
|
import SwiftUI
|
|
|
|
@Observable
|
|
public class BasePlayerRegistration: SyncedModelObject, SyncedStorable {
|
|
|
|
public static func resourceName() -> String { return "player-registrations" }
|
|
public static func tokenExemptedMethods() -> [HTTPMethod] { return [] }
|
|
public static var copyServerResponse: Bool = false
|
|
|
|
public var id: String = Store.randomId()
|
|
public var teamRegistration: String? = nil
|
|
public var firstName: String = ""
|
|
public var lastName: String = ""
|
|
public var licenceId: String? = nil
|
|
public var rank: Int? = nil
|
|
public var paymentType: PlayerPaymentType? = nil
|
|
public var sex: PlayerSexType? = nil
|
|
public var tournamentPlayed: Int? = nil
|
|
public var points: Double? = nil
|
|
public var clubName: String? = nil
|
|
public var ligueName: String? = nil
|
|
public var assimilation: String? = nil
|
|
public var phoneNumber: String? = nil
|
|
public var email: String? = nil
|
|
public var birthdate: String? = nil
|
|
public var computedRank: Int = 0
|
|
public var source: PlayerRegistration.PlayerDataSource? = nil
|
|
public var hasArrived: Bool = false
|
|
public var coach: Bool = false
|
|
public var captain: Bool = false
|
|
public var registeredOnline: Bool = false
|
|
public var timeToConfirm: Date? = nil
|
|
public var registrationStatus: PlayerRegistration.RegistrationStatus = PlayerRegistration.RegistrationStatus.waiting
|
|
public var paymentId: String? = nil
|
|
public var clubCode: String? = nil
|
|
public var clubMember: Bool = false
|
|
public var contactName: String? = nil
|
|
public var contactPhoneNumber: String? = nil
|
|
public var contactEmail: String? = nil
|
|
|
|
public init(
|
|
id: String = Store.randomId(),
|
|
teamRegistration: String? = nil,
|
|
firstName: String = "",
|
|
lastName: String = "",
|
|
licenceId: String? = nil,
|
|
rank: Int? = nil,
|
|
paymentType: PlayerPaymentType? = nil,
|
|
sex: PlayerSexType? = nil,
|
|
tournamentPlayed: Int? = nil,
|
|
points: Double? = nil,
|
|
clubName: String? = nil,
|
|
ligueName: String? = nil,
|
|
assimilation: String? = nil,
|
|
phoneNumber: String? = nil,
|
|
email: String? = nil,
|
|
birthdate: String? = nil,
|
|
computedRank: Int = 0,
|
|
source: PlayerRegistration.PlayerDataSource? = nil,
|
|
hasArrived: Bool = false,
|
|
coach: Bool = false,
|
|
captain: Bool = false,
|
|
registeredOnline: Bool = false,
|
|
timeToConfirm: Date? = nil,
|
|
registrationStatus: PlayerRegistration.RegistrationStatus = PlayerRegistration.RegistrationStatus.waiting,
|
|
paymentId: String? = nil,
|
|
clubCode: String? = nil,
|
|
clubMember: Bool = false,
|
|
contactName: String? = nil,
|
|
contactPhoneNumber: String? = nil,
|
|
contactEmail: String? = nil
|
|
) {
|
|
super.init()
|
|
self.id = id
|
|
self.teamRegistration = teamRegistration
|
|
self.firstName = firstName
|
|
self.lastName = lastName
|
|
self.licenceId = licenceId
|
|
self.rank = rank
|
|
self.paymentType = paymentType
|
|
self.sex = sex
|
|
self.tournamentPlayed = tournamentPlayed
|
|
self.points = points
|
|
self.clubName = clubName
|
|
self.ligueName = ligueName
|
|
self.assimilation = assimilation
|
|
self.phoneNumber = phoneNumber
|
|
self.email = email
|
|
self.birthdate = birthdate
|
|
self.computedRank = computedRank
|
|
self.source = source
|
|
self.hasArrived = hasArrived
|
|
self.coach = coach
|
|
self.captain = captain
|
|
self.registeredOnline = registeredOnline
|
|
self.timeToConfirm = timeToConfirm
|
|
self.registrationStatus = registrationStatus
|
|
self.paymentId = paymentId
|
|
self.clubCode = clubCode
|
|
self.clubMember = clubMember
|
|
self.contactName = contactName
|
|
self.contactPhoneNumber = contactPhoneNumber
|
|
self.contactEmail = contactEmail
|
|
}
|
|
required public override init() {
|
|
super.init()
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey {
|
|
case _id = "id"
|
|
case _teamRegistration = "teamRegistration"
|
|
case _firstName = "firstName"
|
|
case _lastName = "lastName"
|
|
case _licenceId = "licenceId"
|
|
case _rank = "rank"
|
|
case _paymentType = "paymentType"
|
|
case _sex = "sex"
|
|
case _tournamentPlayed = "tournamentPlayed"
|
|
case _points = "points"
|
|
case _clubName = "clubName"
|
|
case _ligueName = "ligueName"
|
|
case _assimilation = "assimilation"
|
|
case _phoneNumber = "phoneNumber"
|
|
case _email = "email"
|
|
case _birthdate = "birthdate"
|
|
case _computedRank = "computedRank"
|
|
case _source = "source"
|
|
case _hasArrived = "hasArrived"
|
|
case _coach = "coach"
|
|
case _captain = "captain"
|
|
case _registeredOnline = "registeredOnline"
|
|
case _timeToConfirm = "timeToConfirm"
|
|
case _registrationStatus = "registrationStatus"
|
|
case _paymentId = "paymentId"
|
|
case _clubCode = "clubCode"
|
|
case _clubMember = "clubMember"
|
|
case _contactName = "contactName"
|
|
case _contactPhoneNumber = "contactPhoneNumber"
|
|
case _contactEmail = "contactEmail"
|
|
}
|
|
|
|
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.teamRegistration = try container.decodeIfPresent(String.self, forKey: ._teamRegistration) ?? nil
|
|
self.firstName = try container.decodeIfPresent(String.self, forKey: ._firstName) ?? ""
|
|
self.lastName = try container.decodeIfPresent(String.self, forKey: ._lastName) ?? ""
|
|
self.licenceId = try container.decodeIfPresent(String.self, forKey: ._licenceId) ?? nil
|
|
self.rank = try container.decodeIfPresent(Int.self, forKey: ._rank) ?? nil
|
|
self.paymentType = try container.decodeIfPresent(PlayerPaymentType.self, forKey: ._paymentType) ?? nil
|
|
self.sex = try container.decodeIfPresent(PlayerSexType.self, forKey: ._sex) ?? nil
|
|
self.tournamentPlayed = try container.decodeIfPresent(Int.self, forKey: ._tournamentPlayed) ?? nil
|
|
self.points = try container.decodeIfPresent(Double.self, forKey: ._points) ?? nil
|
|
self.clubName = try container.decodeIfPresent(String.self, forKey: ._clubName) ?? nil
|
|
self.ligueName = try container.decodeIfPresent(String.self, forKey: ._ligueName) ?? nil
|
|
self.assimilation = try container.decodeIfPresent(String.self, forKey: ._assimilation) ?? nil
|
|
self.phoneNumber = try container.decodeIfPresent(String.self, forKey: ._phoneNumber) ?? nil
|
|
self.email = try container.decodeIfPresent(String.self, forKey: ._email) ?? nil
|
|
self.birthdate = try container.decodeIfPresent(String.self, forKey: ._birthdate) ?? nil
|
|
self.computedRank = try container.decodeIfPresent(Int.self, forKey: ._computedRank) ?? 0
|
|
self.source = try container.decodeIfPresent(PlayerRegistration.PlayerDataSource.self, forKey: ._source) ?? nil
|
|
self.hasArrived = try container.decodeIfPresent(Bool.self, forKey: ._hasArrived) ?? false
|
|
self.coach = try container.decodeIfPresent(Bool.self, forKey: ._coach) ?? false
|
|
self.captain = try container.decodeIfPresent(Bool.self, forKey: ._captain) ?? false
|
|
self.registeredOnline = try container.decodeIfPresent(Bool.self, forKey: ._registeredOnline) ?? false
|
|
self.timeToConfirm = try container.decodeIfPresent(Date.self, forKey: ._timeToConfirm) ?? nil
|
|
self.registrationStatus = try container.decodeIfPresent(PlayerRegistration.RegistrationStatus.self, forKey: ._registrationStatus) ?? PlayerRegistration.RegistrationStatus.waiting
|
|
self.paymentId = try container.decodeIfPresent(String.self, forKey: ._paymentId) ?? nil
|
|
self.clubCode = try container.decodeIfPresent(String.self, forKey: ._clubCode) ?? nil
|
|
self.clubMember = try container.decodeIfPresent(Bool.self, forKey: ._clubMember) ?? false
|
|
self.contactName = try container.decodeIfPresent(String.self, forKey: ._contactName) ?? nil
|
|
self.contactPhoneNumber = try container.decodeIfPresent(String.self, forKey: ._contactPhoneNumber) ?? nil
|
|
self.contactEmail = try container.decodeIfPresent(String.self, forKey: ._contactEmail) ?? 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.teamRegistration, forKey: ._teamRegistration)
|
|
try container.encode(self.firstName, forKey: ._firstName)
|
|
try container.encode(self.lastName, forKey: ._lastName)
|
|
try container.encode(self.licenceId, forKey: ._licenceId)
|
|
try container.encode(self.rank, forKey: ._rank)
|
|
try container.encode(self.paymentType, forKey: ._paymentType)
|
|
try container.encode(self.sex, forKey: ._sex)
|
|
try container.encode(self.tournamentPlayed, forKey: ._tournamentPlayed)
|
|
try container.encode(self.points, forKey: ._points)
|
|
try container.encode(self.clubName, forKey: ._clubName)
|
|
try container.encode(self.ligueName, forKey: ._ligueName)
|
|
try container.encode(self.assimilation, forKey: ._assimilation)
|
|
try container.encode(self.phoneNumber, forKey: ._phoneNumber)
|
|
try container.encode(self.email, forKey: ._email)
|
|
try container.encode(self.birthdate, forKey: ._birthdate)
|
|
try container.encode(self.computedRank, forKey: ._computedRank)
|
|
try container.encode(self.source, forKey: ._source)
|
|
try container.encode(self.hasArrived, forKey: ._hasArrived)
|
|
try container.encode(self.coach, forKey: ._coach)
|
|
try container.encode(self.captain, forKey: ._captain)
|
|
try container.encode(self.registeredOnline, forKey: ._registeredOnline)
|
|
try container.encode(self.timeToConfirm, forKey: ._timeToConfirm)
|
|
try container.encode(self.registrationStatus, forKey: ._registrationStatus)
|
|
try container.encode(self.paymentId, forKey: ._paymentId)
|
|
try container.encode(self.clubCode, forKey: ._clubCode)
|
|
try container.encode(self.clubMember, forKey: ._clubMember)
|
|
try container.encode(self.contactName, forKey: ._contactName)
|
|
try container.encode(self.contactPhoneNumber, forKey: ._contactPhoneNumber)
|
|
try container.encode(self.contactEmail, forKey: ._contactEmail)
|
|
try super.encode(to: encoder)
|
|
}
|
|
|
|
func teamRegistrationValue() -> TeamRegistration? {
|
|
guard let teamRegistration = self.teamRegistration else { return nil }
|
|
return Store.main.findById(teamRegistration)
|
|
}
|
|
|
|
public func copy(from other: any Storable) {
|
|
guard let playerregistration = other as? BasePlayerRegistration else { return }
|
|
self.id = playerregistration.id
|
|
self.teamRegistration = playerregistration.teamRegistration
|
|
self.firstName = playerregistration.firstName
|
|
self.lastName = playerregistration.lastName
|
|
self.licenceId = playerregistration.licenceId
|
|
self.rank = playerregistration.rank
|
|
self.paymentType = playerregistration.paymentType
|
|
self.sex = playerregistration.sex
|
|
self.tournamentPlayed = playerregistration.tournamentPlayed
|
|
self.points = playerregistration.points
|
|
self.clubName = playerregistration.clubName
|
|
self.ligueName = playerregistration.ligueName
|
|
self.assimilation = playerregistration.assimilation
|
|
self.phoneNumber = playerregistration.phoneNumber
|
|
self.email = playerregistration.email
|
|
self.birthdate = playerregistration.birthdate
|
|
self.computedRank = playerregistration.computedRank
|
|
self.source = playerregistration.source
|
|
self.hasArrived = playerregistration.hasArrived
|
|
self.coach = playerregistration.coach
|
|
self.captain = playerregistration.captain
|
|
self.registeredOnline = playerregistration.registeredOnline
|
|
self.timeToConfirm = playerregistration.timeToConfirm
|
|
self.registrationStatus = playerregistration.registrationStatus
|
|
self.paymentId = playerregistration.paymentId
|
|
self.clubCode = playerregistration.clubCode
|
|
self.clubMember = playerregistration.clubMember
|
|
self.contactName = playerregistration.contactName
|
|
self.contactPhoneNumber = playerregistration.contactPhoneNumber
|
|
self.contactEmail = playerregistration.contactEmail
|
|
}
|
|
|
|
public static func relationships() -> [Relationship] {
|
|
return [
|
|
Relationship(type: TeamRegistration.self, keyPath: \BasePlayerRegistration.teamRegistration),
|
|
]
|
|
}
|
|
|
|
} |