AutomaticDoseRecommendation.swift 889 B

1234567891011121314151617181920212223242526272829303132
  1. //
  2. // AutomaticDoseRecommendation.swift
  3. // NightscoutUploadKit
  4. //
  5. // Created by Pete Schwamb on 1/16/21.
  6. // Copyright © 2021 Pete Schwamb. All rights reserved.
  7. //
  8. import Foundation
  9. public struct AutomaticDoseRecommendation {
  10. let timestamp: Date
  11. let tempBasalAdjustment: TempBasalAdjustment?
  12. let bolusVolume: Double
  13. public init(timestamp: Date, tempBasalAdjustment: TempBasalAdjustment?, bolusVolume: Double) {
  14. self.timestamp = timestamp
  15. self.tempBasalAdjustment = tempBasalAdjustment
  16. self.bolusVolume = bolusVolume
  17. }
  18. public var dictionaryRepresentation: [String: Any] {
  19. var rval = [String: Any]()
  20. rval["timestamp"] = TimeFormat.timestampStrFromDate(timestamp)
  21. rval["tempBasalAdjustment"] = tempBasalAdjustment?.dictionaryRepresentation
  22. rval["bolusVolume"] = bolusVolume
  23. return rval
  24. }
  25. }