import { BuildingBlockInterface, StaticResource, StorageType } from '@allianz/taly-core';
import { Injector } from '@angular/core';
import { Observable } from 'rxjs';
import { PFEFacade } from './pfe-facade';
export interface StoreQuery {
  type: StorageType.PfeStoreQuery;
  query: string;
}
export type BuildingBlockResourceMap = Record<string, StaticResource | StoreQuery>;
export type StaticResourceList = Record<string, StaticResource>;
export function isStoreQuery(query: StaticResource): query is StoreQuery {
  return query !== null && (query as StoreQuery).type === StorageType.PfeStoreQuery;
}
/**
 * Abstractions to be decouple PFE while keeping the query aspect.
 * This will help to move the query handling into the core soon.
 */
export type ObservableFromQueryFunction = (query: string) => Observable<unknown>;
export type ExpressionFromQueryFunction = (query: string) => unknown;
export type PFEFacadeFactory = (
  buildingBlock: BuildingBlockInterface,
  injector: Injector
) => PFEFacade;