import { SimpleFilter , isSimpleFilter } from '@empathyco/x-types' ; import { Store } from 'vuex' ; import { RootXStoreState } from '../../../store/store.types' ; import { addFacetIfNotPresent } from './add-facet-if-not-present' ; import { FilterEntity } from './types' ; /**
 * Allows selecting and deselecting a filter of  SimpleFilter .
 *
 *  internal export class SimpleFilterEntity implements FilterEntity { public static accepts = isSimpleFilter ; public constructor ( protected store ) { } param filter deselect ( filter ) { this . store . commit ( 'x/facets/setFilter' , { ... filter , selected : false } ) ; addFacetIfNotPresent ( this . store , filter . facetId , 'SimpleFacet' ) ; } param filter select ( filter ) { this . store . commit ( 'x/facets/setFilter' , { ... filter , selected : true } ) ; addFacetIfNotPresent ( this . store , filter . facetId , 'SimpleFacet' ) ; } }