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

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

import * as SensorEntityStore from './entity/sensor';
import * as SensorListContainerStore from './container/sensor-list';

export interface State {
  sensor_list: SensorListContainerStore.State;
}

export const REDUCERS = {
  sensor_list: SensorListContainerStore.reducer,
};

export const EFFECTS = [
  SensorEntityStore.Effects,
];

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

export const SensorListContainerSelector = SensorListContainerStore.getSelectors(createSelector(
  selectState,
  (state: State) => {
    return state.sensor_list;
  }
));
