ComputedBGTargets.swift 829 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import Foundation
  2. struct ComputedBGTargetEntry: Codable {
  3. var low: Decimal
  4. var high: Decimal
  5. var start: String
  6. var offset: Int
  7. var maxBg: Decimal?
  8. var minBg: Decimal?
  9. var temptargetSet: Bool?
  10. }
  11. extension ComputedBGTargetEntry {
  12. private enum CodingKeys: String, CodingKey {
  13. case low
  14. case high
  15. case start
  16. case offset
  17. case maxBg = "max_bg"
  18. case minBg = "min_bg"
  19. case temptargetSet = "temptarget_set"
  20. }
  21. }
  22. struct ComputedBGTargets: Codable {
  23. let units: GlucoseUnits
  24. let userPreferredUnits: GlucoseUnits
  25. var targets: [ComputedBGTargetEntry]
  26. }
  27. extension ComputedBGTargets {
  28. private enum CodingKeys: String, CodingKey {
  29. case units
  30. case userPreferredUnits = "user_preferred_units"
  31. case targets
  32. }
  33. }