import { MainWindowState } from '../../../../../models/mainwindow/main-window-state' ; import { NavigationCollection } from '../../../../../models/mainwindow/navigation/navigation-collection' ; import { NavigationState } from '../../../../../models/mainwindow/navigation/navigation-state' ; import { CollectionManager } from '../../../../collection/collection-manager.service' ; import { SetsService } from '../../../../collection/sets-service.service' ; import { UpdateCardSearchResultsEvent } from '../../events/collection/update-card-search-results-event' ; import { Processor } from '../processor' ; export class UpdateCardSearchResultsProcessor implements Processor { constructor ( private collectionManager , private cards ) { } public async process ( event , currentState , stateHistory , navigationState ) { const searchResults = this . cards . searchCards ( event . searchString , currentState . binder . collection ) . map ( ( card ) => card . id ) ; const newCollection = navigationState . navigationCollection . update ( { searchResults : searchResults , } as NavigationCollection ) ; return [ null , navigationState . update ( { isVisible : true , navigationCollection : newCollection , } as NavigationState ) , ] ; } }