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

import { StateSelector } from '@overflow/core/ngrx/store';

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

import * as NotificationStore from './notification';

export interface State {
  notification: NotificationStore.State;
}

export const REDUCERS = {
  notification: NotificationStore.reducer,
};

export const EFFECTS = [
  NotificationStore.Effects,
];

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

export const NotificationSelector = new StateSelector<NotificationStore.State>(createSelector(
  selectNotificationState,
  (state: State) => state.notification
));