import { Dictionary } from '@cmf/core';
import { PrimaryFilterOption } from 'apps/sales/src/app/modules/shelf/defs';

export function primaryFiltersToFiltersDictionary(primaryFilters: PrimaryFilterOption[]): { [key: string]: string[] } {
  if (!primaryFilters) {
    return {};
  }
  return primaryFilters.reduce((acc, curr) => {
    if (!curr.selected) {
      return acc;
    }

    return { ...acc, [curr.key]: String(curr.selected) };
  }, {});
}
