feat: Begins adding climate zone client and location clients.
This commit is contained in:
67
Sources/CoreModels/ClimateZone.swift
Normal file
67
Sources/CoreModels/ClimateZone.swift
Normal file
@@ -0,0 +1,67 @@
|
||||
import Foundation
|
||||
|
||||
public enum ClimateZone {
|
||||
|
||||
public enum ZoneType: String, CaseIterable, Codable, Equatable, Sendable {
|
||||
// NOTE: Keep in this order.
|
||||
|
||||
case hotHumid
|
||||
case moist
|
||||
case dry
|
||||
case marine
|
||||
|
||||
// FIX: Return ZoneIdentifiers.
|
||||
public var zoneIdentifiers: [String] {
|
||||
switch self {
|
||||
case .dry:
|
||||
return ["2B", "3B", "4B", "5B", "6B", "7B"]
|
||||
case .hotHumid:
|
||||
return ["1A", "2A"]
|
||||
case .marine:
|
||||
return ["3C", "4C"]
|
||||
case .moist:
|
||||
return ["3A", "4A", "5A", "6A", "7A"]
|
||||
}
|
||||
}
|
||||
|
||||
public var cfmPerTon: Int {
|
||||
switch self {
|
||||
case .dry: return 450
|
||||
case .hotHumid: return 350
|
||||
case .marine, .moist: return 400
|
||||
}
|
||||
}
|
||||
|
||||
public var label: String {
|
||||
return "\(self == .hotHumid ? "Hot Humid" : rawValue.capitalized) (\(zoneIdentifiers.joined(separator: ", ")))"
|
||||
}
|
||||
|
||||
/// Represents climate zone identifiers.
|
||||
public enum ZoneIdentifier: String, CaseIterable, Codable, Equatable, Sendable {
|
||||
// A zones (hotHumid)
|
||||
case oneA = "1A"
|
||||
case twoA = "2A"
|
||||
// A zones (moist)
|
||||
case threeA = "3A"
|
||||
case fourA = "4A"
|
||||
case fiveA = "5A"
|
||||
case sixA = "6A"
|
||||
case sevenA = "7A"
|
||||
|
||||
// B zones (dry)
|
||||
case twoB = "2B"
|
||||
case threeB = "3B"
|
||||
case fourB = "4B"
|
||||
case fiveB = "5B"
|
||||
case sixB = "6B"
|
||||
case sevenB = "7B"
|
||||
|
||||
// C zones (marine)
|
||||
case threeC = "3C"
|
||||
case fourC = "4C"
|
||||
|
||||
public var label: String { rawValue }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Sources/CoreModels/Cooridinates.swift
Normal file
11
Sources/CoreModels/Cooridinates.swift
Normal file
@@ -0,0 +1,11 @@
|
||||
/// Represents a location coordinates.
|
||||
public struct Coordinates: Codable, Equatable, Sendable {
|
||||
|
||||
public let latitude: Double
|
||||
public let longitude: Double
|
||||
|
||||
public init(latitude: Double, longitude: Double) {
|
||||
self.latitude = latitude
|
||||
self.longitude = longitude
|
||||
}
|
||||
}
|
||||
11
Sources/CoreModels/DesignTemperatures.swift
Normal file
11
Sources/CoreModels/DesignTemperatures.swift
Normal file
@@ -0,0 +1,11 @@
|
||||
/// Represents design temperature conditions.
|
||||
public struct DesignTemperatures: Codable, Equatable, Sendable {
|
||||
|
||||
public let cooling: Double
|
||||
public let heating: Double
|
||||
|
||||
public init(cooling: Double, heating: Double) {
|
||||
self.cooling = cooling
|
||||
self.heating = heating
|
||||
}
|
||||
}
|
||||
27
Sources/CoreModels/Location.swift
Normal file
27
Sources/CoreModels/Location.swift
Normal file
@@ -0,0 +1,27 @@
|
||||
import Foundation
|
||||
|
||||
public struct Location: Codable, Equatable, Sendable {
|
||||
|
||||
public let city: String
|
||||
public let state: String
|
||||
public let zipCode: String
|
||||
public let stateCode: String
|
||||
public let county: String
|
||||
public let coordinates: Coordinates
|
||||
|
||||
public init(
|
||||
city: String,
|
||||
state: String,
|
||||
stateCode: String,
|
||||
zipCode: String,
|
||||
county: String,
|
||||
coordinates: Coordinates
|
||||
) {
|
||||
self.city = city
|
||||
self.zipCode = zipCode
|
||||
self.state = state
|
||||
self.stateCode = stateCode
|
||||
self.county = county
|
||||
self.coordinates = coordinates
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user