This commit is contained in:
2025-10-05 12:42:02 -06:00
parent 4bbd422c09
commit b8f874a433
18 changed files with 147 additions and 432 deletions

View File

@@ -4,9 +4,6 @@
import Foundation
// MARK: - Backup Format Specification v2.0
// Platform-neutral backup format for cross-platform compatibility
// This format ensures portability between iOS and Android while maintaining
// platform-specific implementations
/// Root structure for OpenClimb backup data
struct ClimbDataBackup: Codable {
@@ -37,7 +34,7 @@ struct ClimbDataBackup: Codable {
}
}
/// Platform-neutral gym representation for backup/restore
// Platform-neutral gym representation for backup/restore
struct BackupGym: Codable {
let id: String
let name: String
@@ -46,8 +43,8 @@ struct BackupGym: Codable {
let difficultySystems: [DifficultySystem]
let customDifficultyGrades: [String]
let notes: String?
let createdAt: String // ISO 8601 format
let updatedAt: String // ISO 8601 format
let createdAt: String
let updatedAt: String
/// Initialize from native iOS Gym model
init(from gym: Gym) {
@@ -114,7 +111,7 @@ struct BackupGym: Codable {
}
}
/// Platform-neutral problem representation for backup/restore
// Platform-neutral problem representation for backup/restore
struct BackupProblem: Codable {
let id: String
let gymId: String
@@ -128,8 +125,8 @@ struct BackupProblem: Codable {
let isActive: Bool
let dateSet: String? // ISO 8601 format
let notes: String?
let createdAt: String // ISO 8601 format
let updatedAt: String // ISO 8601 format
let createdAt: String
let updatedAt: String
/// Initialize from native iOS Problem model
init(from problem: Problem) {
@@ -239,7 +236,7 @@ struct BackupProblem: Codable {
}
}
/// Platform-neutral climb session representation for backup/restore
// Platform-neutral climb session representation for backup/restore
struct BackupClimbSession: Codable {
let id: String
let gymId: String
@@ -249,8 +246,8 @@ struct BackupClimbSession: Codable {
let duration: Int64? // Duration in seconds
let status: SessionStatus
let notes: String?
let createdAt: String // ISO 8601 format
let updatedAt: String // ISO 8601 format
let createdAt: String
let updatedAt: String
/// Initialize from native iOS ClimbSession model
init(from session: ClimbSession) {
@@ -327,7 +324,7 @@ struct BackupClimbSession: Codable {
}
}
/// Platform-neutral attempt representation for backup/restore
// Platform-neutral attempt representation for backup/restore
struct BackupAttempt: Codable {
let id: String
let sessionId: String
@@ -337,8 +334,8 @@ struct BackupAttempt: Codable {
let notes: String?
let duration: Int64? // Duration in seconds
let restTime: Int64? // Rest time in seconds
let timestamp: String // ISO 8601 format
let createdAt: String // ISO 8601 format
let timestamp: String
let createdAt: String
/// Initialize from native iOS Attempt model
init(from attempt: Attempt) {