// LoopFollow
// FastRiseAlarmEditor.swift

import SwiftUI

struct FastRiseAlarmEditor: View {
    @Binding var alarm: Alarm

    var body: some View {
        Group {
            InfoBanner(
                text: String(localized: "Alerts when glucose readings rise rapidly. For example, three straight readings each climbing by at least the amount you set.  Optionally limit alerts to only fire above a certain BG."),
                alarmType: alarm.type
            )

            AlarmGeneralSection(alarm: $alarm)

            AlarmBGSection(
                header: String(localized: "Rate of Rise"),
                footer: String(localized: "This is how much the glucose must rise to be considered a fast rise."),
                title: String(localized: "Rises by"),
                range: 3 ... 54,
                value: $alarm.delta
            )

            AlarmStepperSection(
                header: String(localized: "Consecutive Rises"),
                footer: String(localized: "Number of rises—each meeting the rate above—required before an alert fires."),
                title: String(localized: "Rises in a row"),
                range: 1 ... 3,
                step: 1,
                value: $alarm.monitoringWindow
            )

            AlarmBGLimitSection(
                header: String(localized: "BG Limit"),
                footer: String(localized: "When enabled, this alert only fires if the glucose is above the limit you set."),
                toggleText: String(localized: "Use BG Limit"),
                pickerTitle: String(localized: "Rising above"),
                range: 40 ... 300,
                defaultOnValue: 200,
                value: $alarm.aboveBG
            )

            AlarmActiveSection(alarm: $alarm)
            AlarmAudioSection(alarm: $alarm)
            AlarmSnoozeSection(alarm: $alarm)
        }
    }
}
