feat: Cleaning up shared models.
This commit is contained in:
76
Sources/SharedModels/EquipmentMetadata.swift
Normal file
76
Sources/SharedModels/EquipmentMetadata.swift
Normal file
@@ -0,0 +1,76 @@
|
||||
import Foundation
|
||||
|
||||
public struct EquipmentMetadata: Equatable {
|
||||
public var coolingCapacity: CoolingCapacity
|
||||
public var fanType: FanType
|
||||
public var ratedStaticPressure: RatedStaticPressures
|
||||
|
||||
public init(
|
||||
coolingCapacity: CoolingCapacity = .three,
|
||||
fanType: FanType = .constantSpeed,
|
||||
ratedStaticPressure: RatedStaticPressures = .init()
|
||||
) {
|
||||
self.coolingCapacity = coolingCapacity
|
||||
self.fanType = fanType
|
||||
self.ratedStaticPressure = ratedStaticPressure
|
||||
}
|
||||
|
||||
public enum CoolingCapacity: Double, Equatable, CaseIterable, Identifiable, CustomStringConvertible {
|
||||
case half = 0.5
|
||||
case threeQuarter = 0.75
|
||||
case one = 1
|
||||
case oneAndAHalf = 1.5
|
||||
case two = 2
|
||||
case twoAndAHalf = 2.5
|
||||
case three = 3
|
||||
case threeAndAHalf = 3.5
|
||||
case four = 4
|
||||
case five = 5
|
||||
|
||||
public var id: Self { self }
|
||||
|
||||
public static var `default`: Self { .three }
|
||||
|
||||
public var description: String {
|
||||
switch self {
|
||||
case .half:
|
||||
return "1/2 Ton"
|
||||
case .threeQuarter:
|
||||
return "3/4 Ton"
|
||||
case .one:
|
||||
return "1 Ton"
|
||||
case .oneAndAHalf:
|
||||
return "1.5 Tons"
|
||||
case .two:
|
||||
return "2 Tons"
|
||||
case .twoAndAHalf:
|
||||
return "2.5 Tons"
|
||||
case .three:
|
||||
return "3 Tons"
|
||||
case .threeAndAHalf:
|
||||
return "3.5 Tons"
|
||||
case .four:
|
||||
return "4 Tons"
|
||||
case .five:
|
||||
return "5 Tons"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum FanType: Hashable, Equatable, CaseIterable, CustomStringConvertible, Identifiable {
|
||||
case constantSpeed
|
||||
case variableSpeed
|
||||
|
||||
public var id: Self { self }
|
||||
public static var `default`: Self { .constantSpeed }
|
||||
|
||||
public var description: String {
|
||||
switch self {
|
||||
case .constantSpeed:
|
||||
return "Constant Speed"
|
||||
case .variableSpeed:
|
||||
return "Variable Speed"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user