part of 'infinity_scroll_bloc.dart';

abstract class InfinityScrollState extends Equatable {
  const InfinityScrollState();

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

class InfinityScrollInitial extends InfinityScrollState {}

class InfinityScrollFailure extends InfinityScrollState {
  final String errorString;
  InfinityScrollFailure({required this.errorString});
}

class InfinityScrollSuccess<T> extends InfinityScrollState {
  final List<T> items;
  final int page;
  final bool hasReachedMax;

  const InfinityScrollSuccess({required this.items, required this.page, required this.hasReachedMax});

  InfinityScrollSuccess copyWith({List<T>? items, int? page, required bool hasReachedMax}) {
    return InfinityScrollSuccess(items: items ?? this.items, page: page ?? this.page, hasReachedMax: hasReachedMax ?? this.hasReachedMax);
  }

  @override
  List<Object> get props => [items, hasReachedMax];
}
