import 'package:boilerplate/domain/entities/categories/categories_data.dart';
import 'package:boilerplate/domain/entities/categories/intellectual_type_data.dart';

enum FilterPriceChoice {
  empty(-1, -1),
  first(0, 10000),
  second(10001, 50000),
  third(50000, 99999999);

  final int from;
  final int end;

  const FilterPriceChoice(this.from, this.end);
}

class ProductListFilterData {
  static ProductListFilterData instant = ProductListFilterData();

  final List<IntellectualTypeData> intellectualType;
  final List<CategoriesData> categories;
  final List<int> intellectualSelected;
  final List<int> categoriesSelected;
  final double startPrice;
  final double endPrice;
  final FilterPriceChoice priceChoice;
  final String sort;
  final String sortKey;

  ProductListFilterData({
    this.intellectualType = const [],
    this.categories = const [],
    this.intellectualSelected = const [],
    this.categoriesSelected = const [],
    this.startPrice = 0,
    this.endPrice = 0,
    this.priceChoice = FilterPriceChoice.empty,
    this.sort = '',
    this.sortKey = '',
  });

  ProductListFilterData copyWith({
    List<IntellectualTypeData>? newIntellectualType,
    List<CategoriesData>? newCategories,
    List<int>? newIntellectualSelected,
    List<int>? newCategoriesSelected,
    FilterPriceChoice? newPriceChoice,
    double? newStartPrice,
    double? newEndPrice,
    String? newSort,
    String? newSortKey,
  }) {
    return ProductListFilterData(
      intellectualType: newIntellectualType ?? this.intellectualType,
      categories: newCategories ?? this.categories,
      intellectualSelected:
          newIntellectualSelected ?? this.intellectualSelected,
      categoriesSelected: newCategoriesSelected ?? this.categoriesSelected,
      priceChoice: newPriceChoice ?? this.priceChoice,
      startPrice: newStartPrice ?? this.startPrice,
      endPrice: newEndPrice ?? this.endPrice,
      sort: newSort ?? this.sort,
      sortKey: newSortKey ?? this.sortKey,
    );
  }
}
