From 5187fae1c3fbe0b60a822fec901f0a98c80dda38 Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Thu, 28 Jul 2022 20:16:01 +0100 Subject: [PATCH] Add FilePartStatus model --- .../Models/FilePartStatus.swift | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Sources/ElixxirDAppsSDK/Models/FilePartStatus.swift diff --git a/Sources/ElixxirDAppsSDK/Models/FilePartStatus.swift b/Sources/ElixxirDAppsSDK/Models/FilePartStatus.swift new file mode 100644 index 00000000..e2f5e4dc --- /dev/null +++ b/Sources/ElixxirDAppsSDK/Models/FilePartStatus.swift @@ -0,0 +1,19 @@ +public enum FilePartStatus: Equatable { + case partDoesNotExist + case unsent + case arrived + case received + case unknown(code: Int) +} + +extension FilePartStatus { + public init(rawValue: Int) { + switch rawValue { + case let value where value < 0: self = .partDoesNotExist + case 0: self = .unsent + case 1: self = .arrived + case 2: self = .received + case let code: self = .unknown(code: code) + } + } +} -- GitLab