import HealthKit
import SwiftUI

extension LibreConfig {
    final class StateModel: BaseStateModel<Provider> {
        @Injected() var source: LibreTransmitterSource!

        @Published var configured = false

        var unit = HKUnit.millimolesPerLiter

        override func subscribe() {
            configured = source.manager != nil
            unit = settingsManager.settings.units == .mmolL ? .millimolesPerLiter : .milligramsPerDeciliter
        }
    }
}
