class AppPreferences {
  final Map<String, bool> boundaries;
  final bool gentleNudges;
  final bool focusProtection;
  final bool voiceEnabled;
  final bool voiceRepliesEnabled;

  AppPreferences({
    this.boundaries = const {},
    this.gentleNudges = true,
    this.focusProtection = false,
    this.voiceEnabled = true,
    this.voiceRepliesEnabled = true,
  });

  Map<String, dynamic> toMap() {
    return {
      'boundaries': boundaries,
      'gentleNudges': gentleNudges,
      'focusProtection': focusProtection,
      'voiceEnabled': voiceEnabled,
      'voiceRepliesEnabled': voiceRepliesEnabled,
    };
  }

  factory AppPreferences.fromMap(Map<String, dynamic> map) {
    return AppPreferences(
      boundaries: Map<String, bool>.from(map['boundaries'] ?? {}),
      gentleNudges: map['gentleNudges'] ?? true,
      focusProtection: map['focusProtection'] ?? false,
      voiceEnabled: map['voiceEnabled'] ?? true,
      voiceRepliesEnabled: map['voiceRepliesEnabled'] ?? true,
    );
  }

  AppPreferences copyWith({
    Map<String, bool>? boundaries,
    bool? gentleNudges,
    bool? focusProtection,
    bool? voiceEnabled,
    bool? voiceRepliesEnabled,
  }) {
    return AppPreferences(
      boundaries: boundaries ?? this.boundaries,
      gentleNudges: gentleNudges ?? this.gentleNudges,
      focusProtection: focusProtection ?? this.focusProtection,
      voiceEnabled: voiceEnabled ?? this.voiceEnabled,
      voiceRepliesEnabled: voiceRepliesEnabled ?? this.voiceRepliesEnabled,
    );
  }
}
