import Foundation

struct ReminderPreferences {

    private static let enabledKey = "reminders.enabled"
    private static let day1Key = "reminders.1day"
    private static let hours12Key = "reminders.12hours"
    private static let hour1Key = "reminders.1hour"

    static var remindersEnabled: Bool {
        get {
            let stored = UserDefaults.standard.object(forKey: enabledKey)
            return stored != nil ? UserDefaults.standard.bool(forKey: enabledKey) : true
        }
        set { UserDefaults.standard.set(newValue, forKey: enabledKey) }
    }

    static var remind1Day: Bool {
        get {
            let stored = UserDefaults.standard.object(forKey: day1Key)
            return stored != nil ? UserDefaults.standard.bool(forKey: day1Key) : true
        }
        set { UserDefaults.standard.set(newValue, forKey: day1Key) }
    }

    static var remind12Hours: Bool {
        get {
            let stored = UserDefaults.standard.object(forKey: hours12Key)
            return stored != nil ? UserDefaults.standard.bool(forKey: hours12Key) : true
        }
        set { UserDefaults.standard.set(newValue, forKey: hours12Key) }
    }

    static var remind1Hour: Bool {
        get {
            let stored = UserDefaults.standard.object(forKey: hour1Key)
            return stored != nil ? UserDefaults.standard.bool(forKey: hour1Key) : true
        }
        set { UserDefaults.standard.set(newValue, forKey: hour1Key) }
    }
}
