import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';

/// State class for theme management.
/// 
/// This class represents the current theme state of the application,
/// including the selected theme mode and provides utility methods
/// for theme-related operations.
class ThemeState extends Equatable {
  /// The current theme mode of the application.
  final ThemeMode themeMode;

  /// Creates a new [ThemeState] with the specified [themeMode].
  /// 
  /// Defaults to [ThemeMode.system] if no theme mode is provided.
  const ThemeState({this.themeMode = ThemeMode.system});

  /// Whether the current theme mode is explicitly set to dark.
  /// 
  /// Returns true only if the theme mode is [ThemeMode.dark].
  /// Returns false for [ThemeMode.light] and [ThemeMode.system].
  bool get isDarkMode {
    return themeMode == ThemeMode.dark;
  }

  /// Creates a copy of this state with optionally modified properties.
  /// 
  /// Allows updating the theme mode while preserving other state properties.
  /// Useful for state transitions in the theme BLoC.
  ThemeState copyWith({ThemeMode? themeMode}) {
    return ThemeState(
      themeMode: themeMode ?? this.themeMode,
    );
  }

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