part of 'products_bloc.dart';

class ProductListStateData {
  final List<ProductData> products;
  final ProductData? selected;
  final ProductListFilterData? filterData;
  final bool canLoadMore;

  ProductListStateData({
    this.products = const [],
    this.selected,
    this.filterData,
    this.canLoadMore = false,
  });

  ProductListStateData copyWith({
    List<ProductData>? newProducts,
    ProductData? newSelected,
    ProductListFilterData? newFilterData,
    bool? newCanLoadMore,
  }) =>
      ProductListStateData(
        products: newProducts ?? this.products,
        selected: newSelected,
        filterData: newFilterData ?? this.filterData,
        canLoadMore: newCanLoadMore ?? this.canLoadMore,
      );
}

abstract class ProductListState {
  final ProductListStateData data;

  ProductListState(this.data);
}

class InitialState extends ProductListState {
  InitialState(super.data);
}

class GetProductsSuccessState extends ProductListState {
  GetProductsSuccessState(super.data);
}

class GetProductsFailState extends ProductListState {
  GetProductsFailState(super.data);
}

class ProductSelectedState extends ProductListState {
  ProductSelectedState(super.data);
}

class GetProductFilterSuccessState extends ProductListState {
  GetProductFilterSuccessState(super.data);
}

class GetProductFilterFailState extends ProductListState {
  GetProductFilterFailState(super.data);
}

class UpdateFilterState extends ProductListState {
  UpdateFilterState(super.data);
}

class CleanFilterState extends ProductListState {
  CleanFilterState(super.data);
}

class CloseFilterState extends ProductListState {
  CloseFilterState(super.data);
}

class SumitFilterState extends ProductListState {
  SumitFilterState(super.data);
}

class RefreshState extends ProductListState {
  RefreshState(super.data);
}

class ShowRefreshState extends ProductListState {
  ShowRefreshState(super.data);
}
