<commit_before>//
//  DoseEntry.swift
//  Naterade
//
//  Created by <NAME> on 1/31/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation
import HealthKit


public struct DoseEntry: TimelineValue, Equatable {
    public let type: DoseType
    public let startDate: Date
    public let endDate: Date
    internal let value: Double
    public let unit: DoseUnit
    public let deliveredUnits: Double?
    public let description: String?
    public let insulinType: InsulinType?
    public let automatic: Bool?
    public let manuallyEntered: Bool
    public internal(set) var syncIdentifier: String?
    public let isMutable: Bool
    public let wasProgrammedByPumpUI: Bool

    /// The scheduled basal rate during this dose entry
    public internal(set) var scheduledBasalRate: HKQuantity?

    public init(suspendDate: Date, automatic: Bool? = nil) {
        self.init(type: .suspend, startDate: suspendDate, value: 0, unit: .units, automatic: automatic)
    }

    public init(resumeDate: Date, insulinType: InsulinType? = nil, automatic: Bool? = nil) {
        self.init(type: .resume, startDate: resumeDate, value: 0, unit: .units, insulinType: insulinType, automatic: automatic)
    }

    // If the insulin model field is nil, it's assumed that the model is the type of insulin the pump dispenses
    public init(type: DoseType, startDate: Date, endDate: Date? = nil, value: Double, unit: DoseUnit, deliveredUnits: Double? = nil, description: String? = nil, syncIdentifier: String? = nil, scheduledBasalRate: HKQuantity? = nil, insulinType: InsulinType? = nil, automatic: Bool? = nil, manuallyEntered: Bool = false, isMutable: Bool = false, wasProgrammedByPumpUI: Bool = false) {
        self.type = type
        self.startDate = startDate
        self.endDate = endDate ?? startDate
        self.value = value
        self.unit = unit
        self.deliveredUnits = deliveredUnits<commit_msg>Add wasProgrammedByPumpUI to suspend/resume constructors<commit_after>//
//  DoseEntry.swift
//  Naterade
//
//  Created by <NAME> on 1/31/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation
import HealthKit


public struct DoseEntry: TimelineValue, Equatable {
    public let type: DoseType
    public let startDate: Date
    public let endDate: Date
    internal let value: Double
    public let unit: DoseUnit
    public let deliveredUnits: Double?
    public let description: String?
    public let insulinType: InsulinType?
    public let automatic: Bool?
    public let manuallyEntered: Bool
    public internal(set) var syncIdentifier: String?
    public let isMutable: Bool
    public let wasProgrammedByPumpUI: Bool

    /// The scheduled basal rate during this dose entry
    public internal(set) var scheduledBasalRate: HKQuantity?

    public init(suspendDate: Date, automatic: Bool? = nil, wasProgrammedByPumpUI: Bool = false) {
        self.init(type: .suspend, startDate: suspendDate, value: 0, unit: .units, automatic: automatic, wasProgrammedByPumpUI: wasProgrammedByPumpUI)
    }

    public init(resumeDate: Date, insulinType: InsulinType? = nil, automatic: Bool? = nil, wasProgrammedByPumpUI: Bool = false) {
        self.init(type: .resume, startDate: resumeDate, value: 0, unit: .units, insulinType: insulinType, automatic: automatic, wasProgrammedByPumpUI: wasProgrammedByPumpUI)
    }

    // If the insulin model field is nil, it's assumed that the model is the type of insulin the pump dispenses
    public init(type: DoseType, startDate: Date, endDate: Date? = nil, value: Double, unit: DoseUnit, deliveredUnits: Double? = nil, description: String? = nil, syncIdentifier: String? = nil, scheduledBasalRate: HKQuantity? = nil, insulinType: InsulinType? = nil, automatic: Bool? = nil, manuallyEntered: Bool = false, isMutable: Bool = false, wasProgrammedByPumpUI: Bool = false) {
        self.type = type
        self.startDate = startDate
        self.endDate = endDate ?? startDate
        self.value = value
        self.unit = unit
        self.deliveredUnits = deliveredUnits
{'fraction_non_alphanumeric': 0.08915781674487527, 'fraction_numerical': 0.005433440355643368, 'mean_word_length': 3.6338672768878717, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2956687', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1154, 'n_words': 411}