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

export interface State {
  selectedRoom: string | null;

  selectedMassDetail: number | null;
  massDetailProcessing: boolean;

  selectedRightDrawer: string | null;
  leftSideDrawer: boolean;
  leftSideDrawerIndicator: boolean;
}

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

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
    ),
    selectLeftSideDrawer: createSelector(
      selector,
      (state: State) => state.leftSideDrawer
    ),
    selectLeftSideDrawerIndicator: createSelector(
      selector,
      (state: State) => state.leftSideDrawerIndicator
    )
  };
}
