44 lines
1.1 KiB
Swift
44 lines
1.1 KiB
Swift
import Foundation
|
|
import SwiftData
|
|
|
|
@Model
|
|
final class Exercise {
|
|
var name: String = ""
|
|
var loadType: Int = LoadType.weight.rawValue
|
|
var order: Int = 0
|
|
var sets: Int = 0
|
|
var reps: Int = 0
|
|
var weight: Int = 0
|
|
var duration: Date = Date.distantPast
|
|
var weightLastUpdated: Date = Date()
|
|
var weightReminderTimeIntervalWeeks: Int = 2
|
|
|
|
@Relationship(deleteRule: .nullify)
|
|
var split: Split?
|
|
|
|
init(split: Split, exerciseName: String, order: Int, sets: Int, reps: Int, weight: Int, weightReminderTimeIntervalWeeks: Int = 2) {
|
|
self.split = split
|
|
self.name = exerciseName
|
|
self.order = order
|
|
self.sets = sets
|
|
self.reps = reps
|
|
self.weight = weight
|
|
self.weightReminderTimeIntervalWeeks = weightReminderTimeIntervalWeeks
|
|
}
|
|
}
|
|
|
|
|
|
enum LoadType: Int, CaseIterable {
|
|
case none = 0
|
|
case weight = 1
|
|
case duration = 2
|
|
|
|
var name: String {
|
|
switch self {
|
|
case .none: "None"
|
|
case .weight: "Weight"
|
|
case .duration: "Duration"
|
|
}
|
|
}
|
|
}
|