import { Pipe, PipeTransform } from '@angular/core';
import { SelectFilter } from '../../filter';

@Pipe({
  name: 'hasSelectedFilters',
})
export class HasSelectedFiltersPipe implements PipeTransform {
  hasSelectedFilters = (filter: SelectFilter[]) => {
    return filter.some((f) => f.options.some((o) => o.selected));
  };

  transform(filters: SelectFilter[]): boolean {
    return this.hasSelectedFilters(filters);
  }
}
