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

export interface State {
  selectedRoom: string | null;

  selectedMassDetail: number | null;
  massDetailProcessing: boolean;

  selectedRightDrawer: string | null;
}

export const initialState: State = {
  selectedRoom: null,
  selectedMassDetail: null,
  massDetailProcessing: false,
  selectedRightDrawer: ''
};

export function selectors<S>(selector: Selector<any, State>) {
  return {
    selectedRoom: createSelector(
      selector,
      (state: State) => state.selectedRoom
    ),
    selectedMassDetail: createSelector(
      selector,
      (state: State) => state.selectedMassDetail
    ),
    selectedRightDrawer: createSelector(
      selector,
      (state: State) => state.selectedRightDrawer
    )
  };
}
