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.
59 lines
2.0 KiB
59 lines
2.0 KiB
//
|
|
// MockData.swift
|
|
// PadelClub
|
|
//
|
|
// Created by Razmig Sarkissian on 20/03/2024.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension Club {
|
|
static func mock() -> Club {
|
|
Club(name: "AUC", acronym: "AUC")
|
|
}
|
|
|
|
static func newEmptyInstance() -> Club {
|
|
Club(name: "", acronym: "")
|
|
}
|
|
}
|
|
|
|
extension Tournament {
|
|
static func mock() -> Tournament {
|
|
Tournament(groupStageSortMode: .snake, teamSorting: .inscriptionDate, federalCategory: .men, federalLevelCategory: .p100, federalAgeCategory: .senior)
|
|
}
|
|
|
|
static func newEmptyInstance() -> Tournament {
|
|
let lastDataSource: String? = UserDefaults.standard.string(forKey: "lastDataSource")
|
|
let lastDataSourceMaleUnranked: Int = UserDefaults.standard.integer(forKey: "lastDataSourceMaleUnranked")
|
|
let lastDataSourceFemaleUnranked: Int = UserDefaults.standard.integer(forKey: "lastDataSourceFemaleUnranked")
|
|
|
|
var _mostRecentDateAvailable: Date? {
|
|
guard let lastDataSource else { return nil }
|
|
return URL.importDateFormatter.date(from: lastDataSource)
|
|
}
|
|
|
|
let maleUnrankedValue : Int? = lastDataSourceMaleUnranked == 0 ? nil : lastDataSourceMaleUnranked
|
|
let femaleUnrankedValue : Int? = lastDataSourceFemaleUnranked == 0 ? nil : lastDataSourceMaleUnranked
|
|
let rankSourceDate = _mostRecentDateAvailable
|
|
|
|
return Tournament(groupStageSortMode: .snake, rankSourceDate: rankSourceDate, teamSorting: .inscriptionDate, federalCategory: .men, federalLevelCategory: .p100, federalAgeCategory: .senior, maleUnrankedValue: maleUnrankedValue, femaleUnrankedValue: femaleUnrankedValue)
|
|
}
|
|
}
|
|
|
|
extension Match {
|
|
static func mock() -> Match {
|
|
Match(index: 0, broadcasted: false, order: 0)
|
|
}
|
|
}
|
|
|
|
extension TeamRegistration {
|
|
static func mock() -> TeamRegistration {
|
|
TeamRegistration(tournament: "")
|
|
}
|
|
}
|
|
|
|
extension PlayerRegistration {
|
|
static func mock() -> PlayerRegistration {
|
|
PlayerRegistration(firstName: "Raz", lastName: "Sark", sex: 1)
|
|
}
|
|
}
|
|
|