2018-11-07 08:43:48 +01:00
|
|
|
import { DetailNavigable } from './detail-navigable';
|
2019-01-19 21:55:06 +01:00
|
|
|
import { SearchRepresentation } from 'app/core/ui-services/search.service';
|
2018-11-07 08:43:48 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Asserts, if the given object is searchable.
|
|
|
|
*
|
|
|
|
* @param object The object to check
|
|
|
|
*/
|
|
|
|
export function isSearchable(object: any): object is Searchable {
|
|
|
|
return (<Searchable>object).formatForSearch !== undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* One can search for every object implementing this interface.
|
|
|
|
*/
|
|
|
|
export interface Searchable extends DetailNavigable {
|
|
|
|
/**
|
|
|
|
* Should return strings that represents the object.
|
|
|
|
*/
|
|
|
|
formatForSearch: () => SearchRepresentation;
|
|
|
|
}
|