part of 'scan_history_bloc.dart';

abstract class ScanHistoryEvent extends Equatable {
  const ScanHistoryEvent();

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

/// Triggered to fetch the scan history list from the API
class FetchScanHistoryEvent extends ScanHistoryEvent {
  final DateTime? date;
  final String? status;
  final bool clearDate; // Explicitly set to true if we want to clear the date filter

  const FetchScanHistoryEvent({this.date, this.status, this.clearDate = false});

  @override
  List<Object?> get props => [date, status, clearDate];
}

/// Triggered to refresh the scan history list (pull-to-refresh)
class RefreshScanHistoryEvent extends ScanHistoryEvent {
  const RefreshScanHistoryEvent();
}

/// Triggered to update the selected date filter
class UpdateScanHistoryDateEvent extends ScanHistoryEvent {
  final DateTime? date; // Null means 'All'

  const UpdateScanHistoryDateEvent({this.date});

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

/// Triggered to update the selected status filter
class UpdateScanHistoryStatusEvent extends ScanHistoryEvent {
  final String status;

  const UpdateScanHistoryStatusEvent({required this.status});

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

/// Triggered to search/filter scan history by keyword
class SearchScanHistoryEvent extends ScanHistoryEvent {
  final String query;

  const SearchScanHistoryEvent({required this.query});

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

/// Triggered to select a specific scan history item for detail view
class SelectScanHistoryEvent extends ScanHistoryEvent {
  final ScanHistory selectedItem;

  const SelectScanHistoryEvent({required this.selectedItem});

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

/// Triggered to clear the selected item (navigate back from detail)
class ClearSelectedScanHistoryEvent extends ScanHistoryEvent {
  const ClearSelectedScanHistoryEvent();
}