import { Facet , Filter } from '@empathyco/x-types' ; import { XActionContext , XStoreModule } from '../../../store' ; public export interface FacetsState { /** Record of all available filters indexed by its id. */ filters : Record < Filter [ 'id' ] , Filter > ; /** Record specifying the group each facet belongs to. */ groups : Record < Facet [ 'id' ] , GroupId > ; /** The facets without their filters. */ facets : Record < Facet [ 'id' ] , Omit < Facet , 'filters' > > ; } public export interface FacetsGetters { /**
     * List of all selected filters.
     */ selectedFilters : Filter [ ] ; /**
     * List of all selected filters grouped by their facet.
     */ selectedFiltersByFacet : FiltersByFacet ; /**
     * List of all facets with their filters.
     */ facets : Record < Facet [ 'id' ] , Facet > ; } public export interface FacetsMutations { /**
     * Removes the filter from the  FacetsState . filters record.
     *
     *  param filter removeFilter ( filter ) : void ; /**
     * Removes a list of filters from the  FacetsState . filters record.
     *
     *  param filters removeFilters ( filters ) : void ; param facetGroupEntry setFacetGroup ( facetGroupEntry ) : void ; /**
     * Adds a list of filters to the  FacetsState . filters record.
     *
     *  param filters setFilters ( filters ) : void ; /**
     * Adds the filter to the  FacetsState . filters record.
     *
     *  param filter setFilter ( filter ) : void ; /**
     * Removes the facet from the  FacetsState . facets record.
     *
     *  param facet removeFacet ( facet ) : void ; /**
     * Adds the facet to the  FacetsState . facets record.
     *
     *  param facet setFacet ( facet ) : void ; } public export interface FacetsActions { } public export type FacetsActionsContext = XActionContext < FacetsState , FacetsGetters , FacetsMutations , FacetsActions > ; public export type FacetsXStoreModule = XStoreModule < FacetsState , FacetsGetters , FacetsMutations , FacetsActions > ; public export type GroupId = string ; public export interface FacetGroupEntry { /** The facet id. */ facetId : Facet [ 'id' ] ; /** The group id. */ groupId : GroupId ; } public export type FiltersByFacet = Record < Facet [ 'id' ] , Filter [ ] > ;