import { EditableNumberRangeFilter , HierarchicalFilter , NumberRangeFilter , RangeValue , SimpleFilter , RawFilter } from '@empathyco/x-types' ; /**
 * Creates a  {@link @empathyco/x-types#SimpleFilter | SimpleFilter} stub.
 *
 *  param filter returns internal export function getSimpleFilterStub ( filter = { } ) { return Object . assign < SimpleFilter , Partial < SimpleFilter > > ( { facetId : 'category' , id : 'category:test' , modelName : 'SimpleFilter' , selected : false , label : 'Test' , totalResults : 10 } , filter ) ; } /**
 * Creates a  {@link @empathyco/x-types#NumberRangeFilter | NumberRangeFilter} stub.
 *
 *  param filter returns internal export function getNumberRangeFilterStub ( filter = { } ) { return Object . assign < NumberRangeFilter , Partial < NumberRangeFilter > > ( { facetId : 'price_facet' , id : 'price_facet:0 TO 10' , modelName : 'NumberRangeFilter' , selected : false , label : 'Test' , range : { min : 1 , max : 10 } , totalResults : 10 } , filter ) ; } /**
 * Creates a  {@link @empathyco/x-types#HierarchicalFilter | HierarchicalFilter} stub.
 *
 *  param filter returns internal export function getHierarchicalFilterStub ( filter = { } ) { return Object . assign < HierarchicalFilter , Partial < HierarchicalFilter > > ( { facetId : 'category' , id : 'category:test' , modelName : 'HierarchicalFilter' , parentId : null , selected : false , label : 'Test' , totalResults : 10 , children : [ ] } , filter ) ; } /**
 * Creates a  {@link @empathyco/x-types#RawFilter | RawFilter} .
 *
 *  param id returns A  {@link @empathyco/x-types#RawFilter | RawFilter} stub.
  export function createRawFilter ( id ) { return { id , modelName : 'RawFilter' , selected : true } ; } /**
 * Creates a  {@link @empathyco/x-types#SimpleFilter | SimpleFilter} .
 *
 *  param facetId param label param selected param totalResults returns A stub for a  {@link @empathyco/x-types#SimpleFilter | SimpleFilter} .
  export function createSimpleFilter ( facetId , label , selected = false , totalResults = 10 ) { return { id : `${ facetId }:${ label }` , modelName : 'SimpleFilter' , facetId , label , selected , totalResults } ; } /**
 * Creates a  {@link @empathyco/x-types#HierarchicalFilter | HierarchicalFilter} .
 *
 *  param facetId param label param selected param children returns A stub for a  {@link @empathyco/x-types#HierarchicalFilter | HierarchicalFilter} .
  export function createHierarchicalFilter ( facetId , label , selected = false , children = [ ] ) { return { facetId , selected , label , id : `${ facetId }:${ label }` , modelName : 'HierarchicalFilter' , parentId : null , totalResults : 10 , children } ; } /**
 * Creates a  {@link @empathyco/x-types#NumberRangeFilter | NumberRangeFilter} .
 *
 *  param facetId param range param selected returns A stub for a
 *  {@link @empathyco/x-types#NumberRangeFilter | NumberRangeFilter} .
  export function createNumberRangeFilter ( facetId , range = { min : null , max : null } , selected = false ) { return { id : `${ facetId }:${ range . min ?? '*' }-${ range . max ?? '*' }` , modelName : 'NumberRangeFilter' , label : `From ${ String ( range . min ) } to ${ String ( range . max ) }` , facetId , range , selected } ; } /**
 * Creates a  {@link @empathyco/x-types#EditableNumberRangeFilter | EditableNumberRangeFilter} .
 *
 *  param facetId param range param selected returns A stub for a
 *  {@link @empathyco/x-types#EditableNumberRangeFilter | EditableNumberRangeFilter} .
  export function createEditableNumberRangeFilter ( facetId , range = { min : null , max : null } , selected ? ) { return { id : `${ facetId }:${ range . min ?? '*' }-${ range . max ?? '*' }` , facetId , range , modelName : 'EditableNumberRangeFilter' , selected : selected ?? ( range . min !== null || range . max !== null ) } ; } /**
 * Type of a function that creates
 *  {@link @empathyco/x-types#HierarchicalFilter | HierarchicalFilter} s. Based on its label,
 * selected value and children.
  export type CreateHierarchicalFilter = ( label : string , selected ? : boolean , createChildren ? : ( createChildren : CreateHierarchicalFilter ) => HierarchicalFilter [ ] ) => HierarchicalFilter [ ] ; /**
 * Creates a factory of
 *  {@link @empathyco/x-types#HierarchicalFilter | HierarchicalFilter} s.
 *
 *  remarks param facetId param parentId returns export function createHierarchicalFilterFactory ( facetId , parentId = null ) { return ( label , selected , createChildren ) : HierarchicalFilter [ ] => { const filter = createHierarchicalFilter ( facetId , label , selected ) ; const children = createChildren ? createChildren ( createHierarchicalFilterFactory ( facetId , filter . id ) ) : [ ] ; filter . parentId = parentId ; filter . children = children . filter ( child => child . parentId === filter . id ) . map ( filter => filter . id ) ; return [ filter , ... children ] ; } ; }