56 lines
No EOL
1.2 KiB
Swift
56 lines
No EOL
1.2 KiB
Swift
//
|
|
// LicenseLevel.swift
|
|
// KeysForAll
|
|
//
|
|
// License levels for the Keys for All system
|
|
//
|
|
|
|
import Foundation
|
|
|
|
/// Represents different license levels in the Keys for All system
|
|
public enum LicenseLevel: Int, CaseIterable, Codable {
|
|
case free = 0
|
|
case level1 = 1
|
|
case level2 = 2
|
|
|
|
/// Display name for the license level
|
|
public var displayName: String {
|
|
switch self {
|
|
case .free:
|
|
return "Free"
|
|
case .level1:
|
|
return "Level 1 🔑"
|
|
case .level2:
|
|
return "Level 2 🔑🔑"
|
|
}
|
|
}
|
|
|
|
/// Short display name without emoji
|
|
public var shortName: String {
|
|
switch self {
|
|
case .free:
|
|
return "Free"
|
|
case .level1:
|
|
return "Level 1"
|
|
case .level2:
|
|
return "Level 2"
|
|
}
|
|
}
|
|
|
|
/// Number of keys required for this level
|
|
public var requiredKeys: Int {
|
|
return self.rawValue
|
|
}
|
|
|
|
/// Initialize from key count
|
|
public init(keyCount: Int) {
|
|
switch keyCount {
|
|
case 0:
|
|
self = .free
|
|
case 1:
|
|
self = .level1
|
|
default:
|
|
self = .level2
|
|
}
|
|
}
|
|
} |