import 'package:aves/model/filters/filters.dart';
import 'package:aves/model/settings/settings.dart';
import 'package:aves/widgets/filter_grids/common/action_delegates/chip_set.dart';
import 'package:aves_model/aves_model.dart';

class AlbumChipSetActionDelegate extends ChipSetActionDelegate<CollectionFilter> {
  static const _routeName = '/albums';

  final Iterable<FilterGridItem<CollectionFilter>> _items;

  AlbumChipSetActionDelegate(this._items);

  @override
  Iterable<FilterGridItem<CollectionFilter>> get allItems => _items;

  @override
  ChipSortFactor get sortFactor => settings.albumSortFactor;

  @override
  set sortFactor(ChipSortFactor factor) => settings.albumSortFactor = factor;

  @override
  bool get sortReverse => settings.albumSortReverse;

  @override
  set sortReverse(bool value) => settings.albumSortReverse = value;

  @override
  TileLayout get tileLayout => settings.getTileLayout(_routeName);

  @override
  set tileLayout(TileLayout tileLayout) {
    settings.setTileLayout(_routeName, tileLayout);
  }
}
