import '../../loadable_state/loading_error.dart';

class LoadableHydratedBlocEvent<TState> {}

class Emit<TState> extends LoadableHydratedBlocEvent<TState> {
  final TState Function(TState state) state;
  Emit(this.state);
}

class DataGathered<TState> extends LoadableHydratedBlocEvent<TState> {
  final TState Function(TState state) state;
  DataGathered(this.state);
}

class Error<TState> extends LoadableHydratedBlocEvent<TState> {
  final LoadingError error;
  Error(this.error);
}

class RefetchStarted<TState> extends LoadableHydratedBlocEvent<TState> {}

/// Sets the state's `statusText` — a transient progress note under the
/// primary loading spinner (e.g. "Erneuter Versuch (2 von 3) …"). Cleared
/// automatically by [DataGathered], [Error], [RefetchStarted] and [Reset].
class LoadingStatus<TState> extends LoadableHydratedBlocEvent<TState> {
  final String? statusText;
  LoadingStatus(this.statusText);
}

class Reset<TState> extends LoadableHydratedBlocEvent<TState> {}
