import {
    createSelector,
    createFeatureSelector,
    ActionReducerMap,
} from '@ngrx/store';

import { StateSelector } from 'packages/core/ngrx/store';

import { MODULE } from '../crawler.constant';

import * as ListStore from './list';

export interface State {
    crawlers: ListStore.State;
}

export const REDUCERS = {
    crawlers: ListStore.reducer,
};

export const EFFECTS = [
    ListStore.Effects,
];

export const selectCrawlerState = createFeatureSelector<State>(MODULE.name);

export const ReadAllCrawlerSelector = new StateSelector<ListStore.State>(createSelector(
    selectCrawlerState,
    (state: State) => state.crawlers
));
