// ABOUTME: Settings events for BLoC pattern managing user preference changes
// ABOUTME: Defines all events that can trigger settings state changes with proper equatable support
import 'package:equatable/equatable.dart';
import '../../models/settings/app_settings.dart';
import '../../models/settings/theme_settings.dart';
import '../../models/settings/unit_settings.dart';
import '../../models/settings/privacy_settings.dart';

/// Base class for all settings events
abstract class SettingsEvent extends Equatable {
  const SettingsEvent();

  @override
  List<Object?> get props => [];
}

/// Event to load settings from storage
class LoadSettingsEvent extends SettingsEvent {
  const LoadSettingsEvent();
}

/// Event to reset settings to defaults
class ResetSettingsEvent extends SettingsEvent {
  const ResetSettingsEvent();
}

/// Event to update complete settings
class UpdateSettingsEvent extends SettingsEvent {
  final AppSettings settings;

  const UpdateSettingsEvent(this.settings);

  @override
  List<Object?> get props => [settings];
}

/// Event to update theme settings
class UpdateThemeSettingsEvent extends SettingsEvent {
  final ThemeSettings themeSettings;

  const UpdateThemeSettingsEvent(this.themeSettings);

  @override
  List<Object?> get props => [themeSettings];
}

/// Event to toggle theme mode (light/dark/system)
class ToggleThemeModeEvent extends SettingsEvent {
  const ToggleThemeModeEvent();
}

/// Event to update specific theme mode
class UpdateThemeModeEvent extends SettingsEvent {
  final AppThemeMode themeMode;

  const UpdateThemeModeEvent(this.themeMode);

  @override
  List<Object?> get props => [themeMode];
}

/// Event to update high contrast mode
class UpdateHighContrastEvent extends SettingsEvent {
  final bool enabled;

  const UpdateHighContrastEvent(this.enabled);

  @override
  List<Object?> get props => [enabled];
}

/// Event to update text scale
class UpdateTextScaleEvent extends SettingsEvent {
  final TextScaleOption textScale;

  const UpdateTextScaleEvent(this.textScale);

  @override
  List<Object?> get props => [textScale];
}

/// Event to update animations enabled
class UpdateAnimationsEnabledEvent extends SettingsEvent {
  final bool enabled;

  const UpdateAnimationsEnabledEvent(this.enabled);

  @override
  List<Object?> get props => [enabled];
}

/// Event to update unit settings
class UpdateUnitSettingsEvent extends SettingsEvent {
  final UnitSettings unitSettings;

  const UpdateUnitSettingsEvent(this.unitSettings);

  @override
  List<Object?> get props => [unitSettings];
}

/// Event to update weight unit
class UpdateWeightUnitEvent extends SettingsEvent {
  final WeightUnit weightUnit;

  const UpdateWeightUnitEvent(this.weightUnit);

  @override
  List<Object?> get props => [weightUnit];
}

/// Event to update date format
class UpdateDateFormatEvent extends SettingsEvent {
  final DateFormat dateFormat;

  const UpdateDateFormatEvent(this.dateFormat);

  @override
  List<Object?> get props => [dateFormat];
}

/// Event to update time format
class UpdateTimeFormatEvent extends SettingsEvent {
  final TimeFormat timeFormat;

  const UpdateTimeFormatEvent(this.timeFormat);

  @override
  List<Object?> get props => [timeFormat];
}

/// Event to update show decimals setting
class UpdateShowDecimalsEvent extends SettingsEvent {
  final bool showDecimals;

  const UpdateShowDecimalsEvent(this.showDecimals);

  @override
  List<Object?> get props => [showDecimals];
}

/// Event to update privacy settings
class UpdatePrivacySettingsEvent extends SettingsEvent {
  final PrivacySettings privacySettings;

  const UpdatePrivacySettingsEvent(this.privacySettings);

  @override
  List<Object?> get props => [privacySettings];
}

/// Event to update local encryption
class UpdateLocalEncryptionEvent extends SettingsEvent {
  final bool enabled;

  const UpdateLocalEncryptionEvent(this.enabled);

  @override
  List<Object?> get props => [enabled];
}

/// Event to update authentication requirement
class UpdateRequireAuthEvent extends SettingsEvent {
  final bool required;

  const UpdateRequireAuthEvent(this.required);

  @override
  List<Object?> get props => [required];
}

/// Event to update biometric authentication
class UpdateBiometricAuthEvent extends SettingsEvent {
  final bool enabled;

  const UpdateBiometricAuthEvent(this.enabled);

  @override
  List<Object?> get props => [enabled];
}

/// Event to update data retention period
class UpdateDataRetentionEvent extends SettingsEvent {
  final DataRetentionPeriod retentionPeriod;

  const UpdateDataRetentionEvent(this.retentionPeriod);

  @override
  List<Object?> get props => [retentionPeriod];
}

/// Event to update backup frequency
class UpdateBackupFrequencyEvent extends SettingsEvent {
  final BackupFrequency backupFrequency;

  const UpdateBackupFrequencyEvent(this.backupFrequency);

  @override
  List<Object?> get props => [backupFrequency];
}

/// Event to update analytics sharing
class UpdateAnalyticsEvent extends SettingsEvent {
  final bool enabled;

  const UpdateAnalyticsEvent(this.enabled);

  @override
  List<Object?> get props => [enabled];
}

/// Event to update crash report sharing
class UpdateCrashReportsEvent extends SettingsEvent {
  final bool enabled;

  const UpdateCrashReportsEvent(this.enabled);

  @override
  List<Object?> get props => [enabled];
}

/// Event to update language
class UpdateLanguageEvent extends SettingsEvent {
  final String language;

  const UpdateLanguageEvent(this.language);

  @override
  List<Object?> get props => [language];
}

/// Event to update notifications
class UpdateNotificationsEvent extends SettingsEvent {
  final bool enabled;

  const UpdateNotificationsEvent(this.enabled);

  @override
  List<Object?> get props => [enabled];
}

/// Event to export settings
class ExportSettingsEvent extends SettingsEvent {
  const ExportSettingsEvent();
}

/// Event to import settings
class ImportSettingsEvent extends SettingsEvent {
  final String settingsJson;

  const ImportSettingsEvent(this.settingsJson);

  @override
  List<Object?> get props => [settingsJson];
}
